[BUG] Edit Tool False Positive "File has been unexpectedly modified" on Windows

Resolved 💬 11 comments Opened Nov 29, 2025 by jigounov Closed Feb 27, 2026

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?

Environment:

  • OS: Windows (Git Bash)
  • File System: NTFS
  • Date: 2025-11-29

Issue:
The Edit tool consistently fails with "File has been unexpectedly modified. Read it again before attempting to write it." even when
no external process is modifying files.

Steps to Reproduce:

  1. Close all IDEs (IntelliJ IDEA, VS Code, etc.)
  2. Create a new test file: echo "test" > test.txt
  3. Use Read tool to read the file
  4. Immediately use Edit tool to modify the file
  5. Error occurs: "File has been unexpectedly modified"

Expected Behavior:
Edit tool should successfully modify the file when no actual modifications have occurred.

Actual Behavior:
Edit tool always fails, even on newly created files that no process has touched.

Investigation Performed:

  • ✅ Confirmed no IDE processes running (IntelliJ closed)
  • ✅ Confirmed no cloud sync services running (Dropbox, OneDrive, etc.)
  • ✅ Confirmed no build tool daemons (Maven, Gradle)
  • ✅ Confirmed no file watchers or antivirus active scanning
  • ✅ Verified file timestamps are completely stable:

Modify: 2025-11-29 08:43:49.645051300 -0800
Timestamp unchanged over multiple checks

  • ✅ Verified file hash (md5sum) remains stable
  • ✅ Tested with brand new file - still fails
  • ✅ Bash file operations (sed, cat, mv) work perfectly

Root Cause Hypothesis:
The Edit tool's file modification detection logic appears to have issues on Windows NTFS file systems, possibly related to:

  • High-precision nanosecond timestamps causing comparison issues
  • Internal metadata caching or state management bug
  • Race condition when Read and Edit are used in quick succession

Workaround:
Use bash commands instead of Edit tool:
```bash
sed -i 's/old/new/' file.txt # Works reliably

Impact:
Severe - Edit tool is unusable on Windows, forcing users to use bash workarounds for all file modifications.

What Should Happen?

Environment:

  • OS: Windows (Git Bash)
  • File System: NTFS
  • Date: 2025-11-29

Issue:
The Edit tool consistently fails with "File has been unexpectedly modified. Read it again before attempting to write it." even when
no external process is modifying files.

Steps to Reproduce:

  1. Close all IDEs (IntelliJ IDEA, VS Code, etc.)
  2. Create a new test file: echo "test" > test.txt
  3. Use Read tool to read the file
  4. Immediately use Edit tool to modify the file
  5. Error occurs: "File has been unexpectedly modified"

Expected Behavior:
Edit tool should successfully modify the file when no actual modifications have occurred.

Actual Behavior:
Edit tool always fails, even on newly created files that no process has touched.

Investigation Performed:

  • ✅ Confirmed no IDE processes running (IntelliJ closed)
  • ✅ Confirmed no cloud sync services running (Dropbox, OneDrive, etc.)
  • ✅ Confirmed no build tool daemons (Maven, Gradle)
  • ✅ Confirmed no file watchers or antivirus active scanning
  • ✅ Verified file timestamps are completely stable:

Modify: 2025-11-29 08:43:49.645051300 -0800
Timestamp unchanged over multiple checks

  • ✅ Verified file hash (md5sum) remains stable
  • ✅ Tested with brand new file - still fails
  • ✅ Bash file operations (sed, cat, mv) work perfectly

Root Cause Hypothesis:
The Edit tool's file modification detection logic appears to have issues on Windows NTFS file systems, possibly related to:

  • High-precision nanosecond timestamps causing comparison issues
  • Internal metadata caching or state management bug
  • Race condition when Read and Edit are used in quick succession

Workaround:
Use bash commands instead of Edit tool:
```bash
sed -i 's/old/new/' file.txt # Works reliably

Impact:
Severe - Edit tool is unusable on Windows, forcing users to use bash workarounds for all file modifications.

Error Messages/Logs

Steps to Reproduce

Environment:

  • OS: Windows (Git Bash)
  • File System: NTFS
  • Date: 2025-11-29

Issue:
The Edit tool consistently fails with "File has been unexpectedly modified. Read it again before attempting to write it." even when
no external process is modifying files.

Steps to Reproduce:

  1. Close all IDEs (IntelliJ IDEA, VS Code, etc.)
  2. Create a new test file: echo "test" > test.txt
  3. Use Read tool to read the file
  4. Immediately use Edit tool to modify the file
  5. Error occurs: "File has been unexpectedly modified"

Expected Behavior:
Edit tool should successfully modify the file when no actual modifications have occurred.

Actual Behavior:
Edit tool always fails, even on newly created files that no process has touched.

Investigation Performed:

  • ✅ Confirmed no IDE processes running (IntelliJ closed)
  • ✅ Confirmed no cloud sync services running (Dropbox, OneDrive, etc.)
  • ✅ Confirmed no build tool daemons (Maven, Gradle)
  • ✅ Confirmed no file watchers or antivirus active scanning
  • ✅ Verified file timestamps are completely stable:

Modify: 2025-11-29 08:43:49.645051300 -0800
Timestamp unchanged over multiple checks

  • ✅ Verified file hash (md5sum) remains stable
  • ✅ Tested with brand new file - still fails
  • ✅ Bash file operations (sed, cat, mv) work perfectly

Root Cause Hypothesis:
The Edit tool's file modification detection logic appears to have issues on Windows NTFS file systems, possibly related to:

  • High-precision nanosecond timestamps causing comparison issues
  • Internal metadata caching or state management bug
  • Race condition when Read and Edit are used in quick succession

Workaround:
Use bash commands instead of Edit tool:
```bash
sed -i 's/old/new/' file.txt # Works reliably

Impact:
Severe - Edit tool is unusable on Windows, forcing users to use bash workarounds for all file modifications.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

not sure

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Environment:

  • OS: Windows (Git Bash)
  • File System: NTFS
  • Date: 2025-11-29

Issue:
The Edit tool consistently fails with "File has been unexpectedly modified. Read it again before attempting to write it." even when
no external process is modifying files.

Steps to Reproduce:

  1. Close all IDEs (IntelliJ IDEA, VS Code, etc.)
  2. Create a new test file: echo "test" > test.txt
  3. Use Read tool to read the file
  4. Immediately use Edit tool to modify the file
  5. Error occurs: "File has been unexpectedly modified"

Expected Behavior:
Edit tool should successfully modify the file when no actual modifications have occurred.

Actual Behavior:
Edit tool always fails, even on newly created files that no process has touched.

Investigation Performed:

  • ✅ Confirmed no IDE processes running (IntelliJ closed)
  • ✅ Confirmed no cloud sync services running (Dropbox, OneDrive, etc.)
  • ✅ Confirmed no build tool daemons (Maven, Gradle)
  • ✅ Confirmed no file watchers or antivirus active scanning
  • ✅ Verified file timestamps are completely stable:

Modify: 2025-11-29 08:43:49.645051300 -0800
Timestamp unchanged over multiple checks

  • ✅ Verified file hash (md5sum) remains stable
  • ✅ Tested with brand new file - still fails
  • ✅ Bash file operations (sed, cat, mv) work perfectly

Root Cause Hypothesis:
The Edit tool's file modification detection logic appears to have issues on Windows NTFS file systems, possibly related to:

  • High-precision nanosecond timestamps causing comparison issues
  • Internal metadata caching or state management bug
  • Race condition when Read and Edit are used in quick succession

Workaround:
Use bash commands instead of Edit tool:
```bash
sed -i 's/old/new/' file.txt # Works reliably

Impact:
Severe - Edit tool is unusable on Windows, forcing users to use bash workarounds for all file modifications.

View original on GitHub ↗

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