Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
dawid-czarnecki opened this issue Aug 11, 2024 · 4 comments
Labels
bug Something isn't working triage Interesting but stale issue. Will be close if inactive for 3 more days after label added.

Comments

@dawid-czarnecki
Copy link

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.

@dawid-czarnecki dawid-czarnecki added bug Something isn't working triage Interesting but stale issue. Will be close if inactive for 3 more days after label added. labels Aug 11, 2024
@bambanx
Copy link

bambanx commented Aug 13, 2024

same problem

@iguy0
Copy link

iguy0 commented Aug 24, 2024

Same error

@mbrueggemann
Copy link

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):

  • run the command and get the error
  • there should be a .gpteng/file_selection.toml file containing your project files
  • remove the # for all files you want to include for the calculation, the more files you add, the better the code suggestions but also the higher the costs

@Patys
Copy link

Patys commented Sep 11, 2024

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:

chosen_editor = os.environ.get("EDITOR")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Interesting but stale issue. Will be close if inactive for 3 more days after label added.
Projects
None yet
Development

No branches or pull requests

5 participants