Edit and MultiEdit tools fail with persistent 'File has been modified since read' errors
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.51 (Claude Code)
- Operating System: CentOS Linux 8
- Terminal: xterm-256color
Bug Description
File update operations using Edit and MultiEdit tools fail with persistent "File has been modified since read" errors, even when no external modifications have occurred. The tools require re-reading files before editing, but continue to fail after re-reading.
Steps to Reproduce
- Create a new file using the Write tool
- Read the file using the Read tool to verify contents
- Attempt to update the file using the Edit tool with valid old_string and new_string parameters
- Observe the error: "File has been modified since read, either by the user or by a linter. Read it again before attempting to write it."
- Re-read the file and attempt the edit again
- The same error persists
Expected Behavior
After reading a file, the Edit and MultiEdit tools should successfully update the file content when provided with valid parameters, without requiring multiple read operations or failing due to false modification detection.
Actual Behavior
Both Edit and MultiEdit tools consistently fail with "File has been modified since read" errors, even immediately after reading the file. The tools become unusable for file updates, despite the file content appearing unchanged between reads.
Additional Context
- This issue occurs with newly created files that have not been modified externally
- The error suggests file modification detection is overly sensitive or incorrect
- System reminders indicate file state tracking issues
- Both Edit and MultiEdit tools exhibit the same behavior
I am also getting the same too frequently, tried multiple solutions but didn't work any
given the file 777, ensured g+w, rebooted machine, ran /doctor --- this is still present, will not write to a file.
This started to happen to me all of a sudden today. ⎿ Error: File has been modified since read, either by the user or by a linter. Read it again before attempting to write it.
cline and other tools work fine, but claude code started misbehaving and now unusable for me.
Yeah im having this same issue constantly. Eventually CC ends up creating a new copy of the file, deleting the old one, and replacing it - but this is a really annoying behavior.
Also having this issue, tried killing all daemons, ide, workers, dev server, issue persists
Also having this issue
I'd been having the same issue, my agent is specifying that is the linter modifying the file after he reads it. Any suggestions on how to diagnose that?
I am also encountering this issue along with consistent Error: String to replace not found in file. and Error: InputValidationError: MultiEdit failed due to the following issue: The parametereditstype is expected asarraybut provided asstring``. Overall consistent issue with MultiEdit tool. It takes Claude Code multiple attempts to update the file, eventually cutting corners and quietly omit specific edit operations.
I was running into this, and the root cause was files with an mtime in the future. Simply touching everything fixed it. Future mtime was caused by copying files from a utc host to a box in a negative time zone.
This happens very often, and even when I don't touch the same file...
are any of you running on windows?
I discovered an issue with bash style paths for read and edit built in tools, but it only affects windows
https://github.com/anthropics/claude-code/issues/7918#issuecomment-3438700008
In Claude's own words Bug Title: "Edit tool 'File has been modified' error persists across multiple Read operations in long conversations"
Description: In long conversation sessions, the Edit tool throws "File has been modified since read" errors even when:
- No external process has modified the file
- The file was just read moments before the Edit attempt
- The file's actual modification timestamp hasn't changed
Expected behavior: Edit should compare against the MOST RECENT Read operation Actual behavior: Edit appears to compare against an earlier Read from the same conversation session
This makes long coding sessions extremely difficult as files read multiple times become impossible to edit.
Workaround: Use Write tool or bash commands, but this is less safe.
This remains an issue in Claude 2.0.37. I notice the same does not seem to occur on my Windows 10 machine; if only that was my main. To have this bug present since July is crazy. Time to move on to a working AI, it seems!
Any official response?
Bug is being solved by users so I believe they are ignoring this. Or perhaps they see it as more of a environment quirk than a bug. My main Claude.md has the following instructions to prevent this error from occuring:
"
Windows Environment Rules
- Operating System: Windows 10/11 (NOT Linux, NOT WSL, NOT Unix)
- Git Bash Shell: Commands run in Git Bash on Windows (Unix-like commands available)
- File Paths: ALWAYS use Windows absolute paths like
C:\\Repos\\Xhuma\\xhuma-web-server\\src\\... - Maven Commands: Run directly as
mvn test,mvn clean install, etc. - NO Unix conversions: NEVER use
/mnt/c/path prefixes "
I believe it's the use of absolute paths that is preventing the bug from reoccuring.
Hope this helps
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.
Same root cause confirmed on Windows.
Simplest workaround: use relative paths - they're "permissive" and work regardless of how you previously read the file. No need to worry about path separators.
Also found that this bug is exclusive to Edit tool - Write has no path restrictions.
Full analysis and CLAUDE.md workaround: #10437
This problem is also present on Windows, and is still occurring as of January 2026
@Raundahl I found a workaround that works on Windows - see my comment above. Using relative paths for both Read and Edit resolves the issue.
This bug is actively blocking production agentic workflows. I run ADW (Agentic Developer Workflow) — a multi-agent pipeline that uses Claude Code as its execution engine to implement, test, review, and ship code through Graphite stacked PRs.
The specific trigger: any process that reads modified files — bundle exec rspec, Ruby require, even rails runner — causes the Edit/Write cache to race against the external file read and silently revert all changes. The agent edits a model, edits a controller, then runs bundle exec rspec to validate — and rspec's require touches every modified source file, causing Claude Code to treat them as "modified since read" and revert to stale content. The implementation vanishes mid-session.
The workarounds (writing files via cat <<'HEREDOC' in Bash, committing before every test run) are fragile and add significant friction. They also defeat the purpose of the Edit tool's safety guarantees.
This has been open since July 2025 — nearly 10 months. The bug family spans at least a dozen issues (#42383, #33856, #25623, #28383, #21201, etc). It is actively driving us to evaluate OpenCode and other coding agents as alternatives, because unattended multi-agent runs cannot function when source files silently revert.