Edit tool fails with 'File has been unexpectedly modified' immediately after Read
Status Closed — not planned
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 11 comments · opened Nov 25, 2025 · closed Jan 31, 2026
Description
When attempting to edit a file immediately after reading it, the Edit tool fails with:
File has been unexpectedly modified. Read it again before attempting to write it.
This happens even when:
- The file was just read moments before
- No other processes are modifying the file
- Multiple retry attempts with fresh reads all fail
Steps to Reproduce
- Read a markdown file (e.g., SESSION_LOG.md)
- Immediately attempt to Edit the same file
- Error occurs even though file content hasn't changed
Environment
- Claude Code version: Latest
- Model: claude-opus-4-5-20250929
- OS: Windows 10/11
- File type: Markdown (.md)
Expected Behavior
Edit should succeed when file content matches what was just read.
Actual Behavior
Edit fails repeatedly claiming file was modified, even with immediate retry after fresh read.
Workaround
None found - had to abandon the edit operation.
---
Generated with Claude Code
11 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is happening to me and is incredibly annoying. Happening on VSCode and Terminal...
happening to me a lot too. sometimes it'll be fine, then all of a sudden I start getting these errors and don't see way to make them stop.
Getting this quite a bit as of this morning (just updated to 2.0.55 - I think I was still on 2.0.52 until restarting this morning)
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
Just received this error several times. Version 2.0.76.
Update(supercharge_comparison_v2.py)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● Read(supercharge_comparison_v2.py)
⎿ Read 82 lines
● Update(supercharge_comparison_v2.py)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● Read(supercharge_comparison_v2.py)
⎿ Read 611 lines
● Update(supercharge_comparison_v2.py)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● The file keeps getting modified externally. Let me just run a quick analysis directly:
I read in similar issues that telling Claude to use backslashes instead of forward slashes in Windows paths, this fixes the issue. I just tested and this appears to be true.
I'm getting the same error, Error: File has been unexpectedly modified. Read it again before attempting to write it.
Actually, the issue started when the conversation has compacted automatically or manually. Once it is compacted, the issue has started.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue was closed incorrectly despite recent human comments. This behavior of the bot is reported at https://github.com/anthropics/claude-code/issues/16497. Please upvote that issue, so maybe it gets noticed.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.