Error: File has been unexpectedly modified. Read it again before attempting to write it
I'm having the issue 'Error: File has been unexpectedly modified. Read it again before attempting to write it' persistently after updating to version 2.0.52, making it impossible to use the tool properly.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.0.52
- Feedback ID: f8492b10-1fa5-414d-80b9-9e7db08ee6c8
Errors
[{"error":"Error: File has been unexpectedly modified. Read it again before attempting to write it.\n at Object.call (file:///C:/Users/luizr/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2106:754)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async Gh5 (file:///C:/Users/luizr/AppData/Roaming/npm/node_modules/@anthropic-ai/claude-code/cli.js:2219:20784)","timestamp":"2025-11-25T01:43:39.119Z"}]
I have exactly the same issue:
● Read(Controls\Helpers\ControlHelper.cs)
⎿ Read 210 lines
● Read(Controls\Helpers\Debouncer.cs)
⎿ Read 175 lines
● Read(Controls\Helpers\FileIOHelper.cs)
⎿ Read 45 lines
● Read(Controls\Helpers\FilenameHelper.cs)
⎿ Read 33 lines
● Update(Controls\Helpers\ControlHelper.cs)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● Update(Controls\Helpers\Debouncer.cs)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● Update(Controls\Helpers\FileIOHelper.cs)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
● Update(Controls\Helpers\FilenameHelper.cs)
⎿ Error: File has been unexpectedly modified. Read it again before attempting to write it.
Interesting observation. The problem seems not to be in CLI itself, just tried to downgrade to CLI v2.0.53 (this was working yesterday) and then 2.0.52 and 2.0.51 - nothing helps.
Claude's bug report:
Bug Report: Edit Tool Fails with "File unexpectedly modified" immediately after Read
Environment:
- Platform: Windows (MSYS_NT-10.0-22631)
- Claude Code CLI
Steps to Reproduce:
1. Read a file using the Read tool
2. Immediately attempt to edit the same file using the Edit tool
3. Edit fails with error: "File has been unexpectedly modified. Read it again before attempting to write it."
Expected Behavior:
The Edit should succeed since the file was just read and no external modifications occurred between the Read and Edit
operations.
Actual Behavior:
Edit fails claiming the file was modified, even though:
- No user action modified the file
- The Read and Edit were consecutive operations
- The file content in the Edit old_string matches exactly what was returned by Read
Workaround Attempted:
- Using sed via Bash tool works, but is not the intended workflow
Impact:
This blocks normal file editing workflow entirely, forcing use of shell commands instead.
@claude fix it
Reporting the SAME issue...nothing new to add regarding details but the bugs that are cropping up in Claude Code are making me regret renewing my Max subscription. I left for the downgraded output and performance, only to come back to the same. Lesson is now LEARNED.
Reporting the SAME issue...nothing new to add regarding details but the bugs that are cropping up in Claude Code are making me regret renewing my Max subscription. I left for the downgraded output and performance, only to come back to the same. Lesson is now LEARNED.
It got fixed ages ago. I guess in a few days after. Seems to be a misconfiguration because of some other package updates. But if you got it only now you may try to downgrade CLI till it get work. There are many clones of this report and in some of them were exact versions that worked perfectly.
My current version of CLI (2.0.61) is working well.
I hear you but this volleying between versions approach reintroduces old bugs that I was glad to see fixed and therefore leaves me to choose how much I wish to be inconvenienced as opposed to the issue(s) actually being fixed with a forward momentum vs accepting regressive workarounds.
On Tue, Dec 9, 2025 at 4:01 AM Dimonka2 @.***> wrote:
Dimonka2 left a comment (anthropics/claude-code#12315) https://github.com/anthropics/claude-code/issues/12315#issuecomment-3631892574
Reporting the SAME issue...nothing new to add regarding details but the bugs that are cropping up in Claude Code are making me regret renewing my Max subscription. I left for the downgraded output and performance, only to come back to the same. Lesson is now LEARNED.
It got fixed ages ago. I guess in a few days after. Seems to be a misconfiguration because of some other package updates. But if you got it only now you may try to downgrade CLI till it worked. There are many clones of this report and in some of them were exact versions that worked perfectly.
My current version of CLI (2.0.61) is working well.
— Reply to this email directly, view it on GitHub https://github.com/anthropics/claude-code/issues/12315#issuecomment-3631892574, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQG6WHSYK52UWFYEUTLY634A22YJAVCNFSM6AAAAACNC3MJEOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMMZRHA4TENJXGQ . You are receiving this because you commented.Message ID: @.***>