Question

Claude Code keeps saying 'File has not been read yet' and retries

Solved · 171 viewsasked by emeka

Lots of these lately:

It then reads the file and continues. Is something broken? It feels like it wastes time.

What I’ve tried

Updated Claude Code. Checked I don't have two sessions open on the same folder.

Comment
Do you have format on save turned on? The second message is almost always the editor touching the file. ines_data

2 answers

Marked as helpful by the asker
thandeka

Nothing broken, that's a safety check. It refuses to overwrite a file it hasn't seen (first message) or one that changed since it last read it (second message), so it doesn't wipe out your edits.

The second one usually means something else touches files while it works: format-on-save in your editor, a prettier hook, or you typing in the same file. If it's constant, turn off format-on-save for that project and let a hook format after Claude's edits instead.

Comment
Format on save in VS Code, yes. Turned it off for this workspace, messages mostly gone. emeka
Nice. A PostToolUse prettier hook gives you the formatting back without the conflict. thandeka
diego_mx

Also happens when you switch git branches while Claude is working, or run two sessions in the same folder. If you want two in parallel, use a separate git worktree for each.

Comment
Ha, I do switch branches mid-session sometimes. Didn't know that confuses it. Worktrees it is. emeka