aider icon indicating copy to clipboard operation
aider copied to clipboard

Aider 'Unable to read staged files' on load and when adding files to chat

Open Trolann opened this issue 7 months ago • 1 comments

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

Image

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

Trolann avatar Apr 25 '25 16:04 Trolann

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

duleorlovic avatar Apr 26 '25 11:04 duleorlovic

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.

Trolann avatar Apr 28 '25 15:04 Trolann

I have the same issue, running the commands didn't fix it either

wyuenho avatar May 20 '25 13:05 wyuenho

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:

Image

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

tbedor-square2 avatar Jun 17 '25 15:06 tbedor-square2

Related / duplicate of

https://github.com/Aider-AI/aider/issues/3914 https://github.com/Aider-AI/aider/issues/211

tombedor avatar Jun 17 '25 16:06 tombedor