Edit tool fails with 'File has been unexpectedly modified' immediately after Read

Status Closed — not planned
Maintainer reply None cached
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:

  1. The file was just read moments before
  2. No other processes are modifying the file
  3. Multiple retry attempts with fresh reads all fail

Steps to Reproduce

  1. Read a markdown file (e.g., SESSION_LOG.md)
  2. Immediately attempt to Edit the same file
  3. 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

View original on GitHub ↗

11 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/11976
  2. https://github.com/anthropics/claude-code/issues/10437
  3. https://github.com/anthropics/claude-code/issues/11684

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

ghost · 9 months ago

This is happening to me and is incredibly annoying. Happening on VSCode and Terminal...

gbahns · 9 months ago

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.

WeOnlyDoParts · 9 months ago

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)

github-actions[bot] · 8 months ago

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.

WeOnlyDoParts · 8 months ago

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:

WeOnlyDoParts · 8 months ago

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.

webmasterfsd · 8 months ago

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.

github-actions[bot] · 7 months ago

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.

marcindulak · 7 months ago

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.

github-actions[bot] · 6 months ago

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.