Edit tool returns "File has been unexpectedly modified" when file is NOT modified

Open 💬 13 comments Opened Nov 26, 2025 by FrancescoB2024

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Description

The Edit tool repeatedly returns error "File has been unexpectedly modified. Read it again before attempting to write
it." even when no external process is modifying the file.

## Steps to Reproduce

  1. Read a file with the Read tool
  2. Immediately attempt to Edit the file
  3. Error appears despite no changes to the file

## Verification

  • Verified with certutil -hashfile <file> MD5 - hash remains identical between reads
  • No Python, VS Code, or other editor processes running
  • No cloud sync (OneDrive/Dropbox) active
  • File is on local SSD (E: drive)

## Environment

  • Windows 10/11
  • Claude Code CLI
  • Local filesystem (not network/cloud)

## Workaround
Using Python directly to modify files:
```python
with open('file.py', 'r', encoding='utf-8') as f:
content = f.read()
content = content.replace('old', 'new')
with open('file.py', 'w', encoding='utf-8') as f:
f.write(content)

Impact

  • Blocks normal workflow
  • Requires workarounds
  • Very frustrating when it persists across 10+ attempts

What Should Happen?

  1. Read a file with the Read tool
  2. Immediately attempt to Edit the file
  3. Error appears despite no changes to the file

Error Messages/Logs

Update(qt_slideshow_util2.py)
  ⎿  Error: File has been unexpectedly modified. Read it again before attempting to write it.

Steps to Reproduce

  1. Read a file with the Read tool
  2. Immediately attempt to Edit the file
  3. Error appears despite no changes to the file

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.54 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Ciao frm Italy to Dario and Daniela Amodei

View original on GitHub ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗