aider GUI fails consistently loading a file with StreamlitAPIException about "the default value is part of the options"
Issue
Hi,
I'm trying to launch the Aider GUI in a folder on my Windows 11 PC, but it crashes as soon as it starts up with StreamlitAPIException: The default value '<file_name_here>' is part of the options. Please make sure that every default values also exists in the options.
Specifically, I have a folder like so D:\code\shell. The folder contains only 2 files, one being .gitignore and the other is called tar-to-wsl.sh. Trying to run Aider with aider tar-to-wsl.sh results in fatal error right after the Streamlit interface becomes available in the browser. Here's the info text that shows up when Streamlit is up and running:
Aider v0.45.1
Models: anthropic/claude-3-5-sonnet-20240620 with diff edit format, weak model claude-3-haiku-20240307
Git repo: .git with 0 files
Repo-map: using 1024 tokens
Added tar-to-wsl.sh to the chat.
It shows 0 files in the repo but still adds the requested file to the chat. Unfortunately it crashes afterwards with this error:
StreamlitAPIException: The default value 'tar-to-wsl.sh' is part of the options. Please make sure that every default values also exists in the options.
Traceback:
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 540, in <module>
status = gui_main()
^^^^^^^^^^
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 536, in gui_main
GUI()
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 368, in __init__
self.do_sidebar()
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 151, in do_sidebar
self.do_add_to_chat()
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 180, in do_add_to_chat
self.do_add_files()
File "C:\Users\ioann\pipx\venvs\aider-chat\Lib\site-packages\aider\gui.py", line 184, in do_add_files
fnames = st.multiselect(
^^^^^^^^^^^^^^^
Running Aider without specifying any file also fails. This time the GUI is loaded and runs successfully, but the dropdown list to select files is deactivated because of "No options to select".
This happens consistently with some repos, while other repos work fine.
Version and model info
Aider v0.45.1 Models: anthropic/claude-3-5-sonnet-20240620 with diff edit format, weak model claude-3-haiku-20240307 Git repo: .git with 0 files Repo-map: using 1024 tokens
you probably already did this, but did you try updating Streamlit? It helped with a problem I had with it yesterday after updating Aider
Thanks for trying aider and filing this issue.
It looks like the file you want to edit is not part of the git repo. Aider says "Git repo: .git with 0 files". Aider should handle this situation better and not refuse to work with an error. I will improve that.
But in the meantime, you can add the file to your git repo to work around this:
git add tar-to-wsl.sh
git commit -m "Adding tar-to-wsl.sh to git"
FYI, the browser UI is experimental and not as well tested as the aider CLI.
Ah I see, didn't think of it. I created the git repo via VS Code, and I assumed it added any untracked files in the folder when I did the initial commit.
you probably already did this, but did you try updating Streamlit? It helped with a problem I had with it yesterday after updating Aider
Aye, I have installed Aider via pipx, so I guess whenever I update Aider it updates every package to match the requirements.txt
FYI, the browser UI is experimental and not as well tested as the aider CLI.
Yeah I'm aware. I haven't had any other issues with it so far though.
Btw I assume you don't want this issue closed yet? Since you tagged it as bug.
Yes, I need to prevent this situation from causing the error you reported.
Just ran into this as well. Is there a technical reason that the file needs to be added to the repository first before this works?