Aider 'Unable to read staged files' on load and when adding files to chat
Issue
When accessing a git repo that has been working fine in the past, aider regularly gives a red warning of "Unable to read staged files". This is especially problematic when adding files (or read only files) to the chat and it pops up a new one with every character, also preventing you from backspacing if you made a mistake
Version and model info
Unable to read staged files: Unable to read staged files: Unable to read staged files: Aider v0.82.2 Main model: anthropic/claude-3-7-sonnet-20250219 with diff edit format, infinite output Weak model: anthropic/claude-3-5-haiku-20241022 Git repo: .git with 228 files Repo-map: using 4096 tokens, auto refresh Added ../.aider.guidelines to the chat (read-only). Unable to read staged files: ─────────────────────────────────────────────
I had the same issue and I found that the issue is gone if I clone my repo again in another folder.
You can also fix the error with
rm -f .git/index
git reset
I had the same issue and I found that the issue is gone if I clone my repo again in another folder.
You can also fix the error with
rm -f .git/index git reset
I believe this started happening after a fresh clone of the repo when my teammates had pushed some extra build files and such. I didn't save the old folder so I can't confirm there. I guess I could cherry pick and see when it started.
Removing the index and resetting didn't fix the issue.
I have the same issue, running the commands didn't fix it either
When this happens the root issue is that your git index is on version 3+, but the underlying git library only supports 1 or 2:
Aider used to refuse to start when this was the case.
You can set your git index to a supported version via:
git update-index --index-version 2
Related / duplicate of
https://github.com/Aider-AI/aider/issues/3914 https://github.com/Aider-AI/aider/issues/211