gpt-engineer-org / gpt-engineer

Platform to experiment with the AI Software Engineer. Terminal based. NOTE: Very different from https://gptengineer.app
MIT License
51.98k stars 6.77k forks source link

Improving existing code: No files were selected. Please select at least one file to proceed. #1200

Open dawid-czarnecki opened 1 month ago

dawid-czarnecki commented 1 month ago

Expected Behavior

Updating the existing code.

Current Behavior

Crashing without saving and/or generating the changes.

Failure Information

I use GPT-4o model.

Failure Logs

The debug_log_file.txt doesn't exist but the following error is generated (I sanitized paths):

gpte project-x -i
Running gpt-engineer in /home/dawid/xxx/project-x 

Using prompt from file: prompt
Update the project to be run as docker container. Make sure it uses docker compose yaml file.
Please select and deselect (add # in front) files, save it, and close it to continue...
write: effective gid does not match group of /dev/pts/0
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/dawid/.local/lib/python3.10/site-packages/gpt_engineer/applications/cli/main.py:458 in     │
│ main                                                                                             │
│                                                                                                  │
│   455 │   files = FileStore(project_path)                                                        │
│   456 │   if not no_execution:                                                                   │
│   457 │   │   if improve_mode:                                                                   │
│ ❱ 458 │   │   │   files_dict_before, is_linting = FileSelector(project_path).ask_for_files()     │
│   459 │   │   │                                                                                  │
│   460 │   │   │   # lint the code                                                                │
│   461 │   │   │   if is_linting:                                                                 │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                  agent = <gpt_engineer.applications.cli.cli_agent.CliAgent object at         │ │
│ │                          0x7ffbcd501fc0>                                                     │ │
│ │                     ai = <gpt_engineer.core.ai.AI object at 0x7ffbccbe06d0>                  │ │
│ │         azure_endpoint = ''                                                                  │ │
│ │           clarify_mode = False                                                               │ │
│ │            code_gen_fn = <function gen_code at 0x7ffbccb15ea0>                               │ │
│ │                  debug = False                                                               │ │
│ │ entrypoint_prompt_file = ''                                                                  │ │
│ │          execution_env = <gpt_engineer.core.default.disk_execution_env.DiskExecutionEnv      │ │
│ │                          object at 0x7ffbcd5004c0>                                           │ │
│ │           execution_fn = <function execute_entrypoint at 0x7ffbccb15fc0>                     │ │
│ │                  files = <gpt_engineer.core.default.file_store.FileStore object at           │ │
│ │                          0x7ffbcd502020>                                                     │ │
│ │        image_directory = ''                                                                  │ │
│ │           improve_mode = True                                                                │ │
│ │              lite_mode = False                                                               │ │
│ │      llm_via_clipboard = False                                                               │ │
│ │                 memory = <gpt_engineer.core.default.disk_memory.DiskMemory object at         │ │
│ │                          0x7ffbcd501270>                                                     │ │
│ │                  model = 'gpt-4o'                                                            │ │
│ │           no_execution = False                                                               │ │
│ │                   path = PosixPath('project-x')                                        │ │
│ │      preprompts_holder = <gpt_engineer.core.preprompts_holder.PrepromptsHolder object at     │ │
│ │                          0x7ffbccbe0700>                                                     │ │
│ │           project_path = 'project-x'                                                   │ │
│ │                 prompt = Prompt(text='Update the project to be run as docker container. Make │ │
│ │                          sure it uses docker compose yaml file.', image_urls=None)           │ │
│ │            prompt_file = 'prompt'                                                            │ │
│ │         self_heal_mode = False                                                               │ │
│ │            temperature = 0.1                                                                 │ │
│ │              use_cache = False                                                               │ │
│ │  use_custom_preprompts = False                                                               │ │
│ │                verbose = False                                                               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/dawid/.local/lib/python3.10/site-packages/gpt_engineer/applications/cli/file_selector.py:1 │
│ 04 in ask_for_files                                                                              │
│                                                                                                  │
│   101 │   │   │   │   )                                                                          │
│   102 │   │   │   │   selected_files = self.editor_file_selector(self.project_path, False)       │
│   103 │   │   │   else:                                                                          │
│ ❱ 104 │   │   │   │   selected_files = self.editor_file_selector(self.project_path, True)        │
│   105 │   │                                                                                      │
│   106 │   │   content_dict = {}                                                                  │
│   107 │   │   for file_path in selected_files:                                                   │
│                                                                                                  │
│ ╭────────────────────────────────────────── locals ──────────────────────────────────────────╮   │
│ │ self = <gpt_engineer.applications.cli.file_selector.FileSelector object at 0x7ffbcd502740> │   │
│ ╰────────────────────────────────────────────────────────────────────────────────────────────╯   │
│                                                                                                  │
│ /home/dawid/.local/lib/python3.10/site-packages/gpt_engineer/applications/cli/file_selector.py:2 │
│ 07 in editor_file_selector                                                                       │
│                                                                                                  │
│   204 │   │   self.open_with_default_editor(                                                     │
│   205 │   │   │   toml_file                                                                      │
│   206 │   │   )  # Open the .toml file in the default editor for user modification               │
│ ❱ 207 │   │   return self.get_files_from_toml(                                                   │
│   208 │   │   │   input_path, toml_file                                                          │
│   209 │   │   )  # Return the list of selected files after user edits                            │
│   210                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │          f = <_io.TextIOWrapper                                                              │ │
│ │              name='/home/dawid/xxx/project-x/.gpteng/fi… │ │
│ │              mode='w' encoding='UTF-8'>                                                      │ │
│ │       init = True                                                                            │ │
│ │ input_path = 'project-x'                                                               │ │
│ │  root_path = PosixPath('project-x')                                                    │ │
│ │          s = '[files]\n# "run.sh" = "selected"\n# code = "selected"\n# "requirements.txt" =  │ │
│ │              "sele'+470                                                                      │ │
│ │       self = <gpt_engineer.applications.cli.file_selector.FileSelector object at             │ │
│ │              0x7ffbcd502740>                                                                 │ │
│ │  toml_file = PosixPath('/home/dawid/xxx/project-x/.gpte… │ │
│ │  tree_dict = {                                                                               │ │
│ │              │   'run.sh': 'selected',                                                       │ │
│ │              │   'code': 'selected',                                                         │ │
│ │              │   'requirements.txt': 'selected',                                             │ │
│ │              │   'createsuperuser': 'selected',                                              │ │
│ │              │   'migrate': 'selected',                                                      │ │
│ │              │   'application.': 'selected',                                                 │ │
│ │              │   'venv\\Scripts\\activate': 'selected',                                      │ │
│ │              │   'runserver': 'selected',                                                    │ │
│ │              │   'repository_directory': 'selected',                                         │ │
│ │              │   'README.md': 'selected',                                                    │ │
│ │              │   ... +6                                                                      │ │
│ │              }                                                                               │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/dawid/.local/lib/python3.10/site-packages/gpt_engineer/applications/cli/file_selector.py:3 │
│ 12 in get_files_from_toml                                                                        │
│                                                                                                  │
│   309 │   │                                                                                      │
│   310 │   │   # Ensure that at least one file is selected, or raise an exception                 │
│   311 │   │   if not selected_files:                                                             │
│ ❱ 312 │   │   │   raise Exception(                                                               │
│   313 │   │   │   │   "No files were selected. Please select at least one file to proceed."      │
│   314 │   │   │   )                                                                              │
│   315                                                                                            │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │    edited_tree = {'linting': {}, 'files': {}}                                                │ │
│ │     input_path = 'project-x'                                                           │ │
│ │ selected_files = []                                                                          │ │
│ │           self = <gpt_engineer.applications.cli.file_selector.FileSelector object at         │ │
│ │                  0x7ffbcd502740>                                                             │ │
│ │      toml_file = PosixPath('/home/dawid/xxx/project-x/.… │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
Exception: No files were selected. Please select at least one file to proceed.

System Information

No such option: --sysinfo Python 3.10.12 Linux Mint 21

Installation Method

GPT-Engineer installed using pip install.

bambanx commented 1 month ago

same problem

iguy0 commented 2 weeks ago

Same error

mbrueggemann commented 2 weeks ago

Hey,

After having the same issue and having a quick look into the python implementation, here is a "workaround" (not sure if it is acutally a workaorund or the desired approach and there is just a little hint missing in the exception):

Patys commented 1 day ago

I was also struggling with it until I found the code responsible for that part. It is using system path to find proper editor, please set one. E.g. I am using export EDITOR="nano".

Here is part of code and some example editors it supports: https://github.com/gpt-engineer-org/gpt-engineer/blob/3db500b7957d09f77f67cd3b77d806c0c6cf52a3/gpt_engineer/applications/cli/file_selector.py#L231