claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

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

Open ManuelMRosa opened this issue 1 month ago • 5 comments

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

ManuelMRosa avatar Nov 25 '25 05:11 ManuelMRosa