Aider-AI/aider · error · ValueError
GUI can currently only be used inside a git repo
Error message
GUI can currently only be used inside a git repo
What it means
Streamlit GUI startup check in get_coder(): after building a Coder via cli_main(return_coder=True), coder.repo is None — the working directory is not a git repository — so the GUI refuses to run. The GUI's state and undo model depend on git.
Source
Thrown at aider/gui.py:75
return
self.keys.add(key)
setattr(self, key, val)
return True
@st.cache_resource
def get_state():
return State()
@st.cache_resource
def get_coder():
coder = cli_main(return_coder=True)
if not isinstance(coder, Coder):
raise ValueError(coder)
if not coder.repo:
raise ValueError("GUI can currently only be used inside a git repo")
io = CaptureIO(
pretty=False,
yes=True,
dry_run=coder.io.dry_run,
encoding=coder.io.encoding,
)
# coder.io = io # this breaks the input_history
coder.commands.io = io
for line in coder.get_announcements():
coder.io.tool_output(line)
return coder
class GUI:
prompt = NoneView on GitHub (pinned to 5dc9490bb3)
Solutions
- cd into the project repo or run `git init` in the project directory, then restart the GUI
- Pass the target directory explicitly (aider gui <path>) so repo detection starts from the right place
- If git is intentionally unused, use the CLI instead of the GUI — the GUI requires a repo
Example fix
# before $ cd /tmp/playground && python -m aider.gui # after $ cd /tmp/playground && git init && python -m aider.gui
Defensive patterns
Strategy: validation
Validate before calling
import subprocess
def inside_git_repo(path: str = ".") -> bool:
return subprocess.run(
["git", "-C", path, "rev-parse", "--is-inside-work-tree"],
capture_output=True,
).returncode == 0 Try / catch
try:
coder = get_coder()
except ValueError as e:
if "inside a git repo" in str(e):
st.error("Open a git repository to use the GUI (run `git init` first).")
st.stop()
raise Prevention
- Launch the GUI from the project's git root or pass the repo path as an argument
- Run git init in new projects before starting aider
- Use the CLI (not the GUI) when you deliberately work outside git
When it happens
Trigger: Running `python -m aider.gui` (or the gui command) from a directory outside any git repo; repo detection failing due to a missing .git or --no-git style settings; running inside a container/scratch dir.
Common situations: First-time users launching the GUI in their home directory or a fresh folder; CI/sandbox environments without git initialized; nested directories where the git root is above an unexpected boundary.
Related errors
- Unknown edit format {edit_format}. Valid formats are: {', '.
- No data found in LLM response!
- # {len(failed)} SEARCH/REPLACE {blocks} failed to match!\n
- Bad/missing filename. The filename must be alone on the line
- Expected `=======`
AI-assisted analysis of Aider-AI/aider@5dc9490bb3 (2026-08-15).
Data as JSON: /api/errors/2e56882a48f8f840.
Report an issue: GitHub.