Bug: Edit/Write tools fail with false positive errors on Windows Git Bash
Resolved 💬 3 comments Opened Dec 22, 2025 by tokincode Closed Dec 25, 2025
Bug Description
On Windows with Git Bash (MINGW64), the Edit and Write tools frequently fail with false positive errors, even when the file has not been modified by any external process.
Environment
- Claude Code Version: 2.0.75
- OS: Windows 10/11 with Git Bash (MINGW64_NT-10.0-26200)
- Shell: Git Bash (MINGW64)
Symptoms
Error 1: "File has been unexpectedly modified"
After using Read tool, immediately using Edit fails with:
Error: File has been unexpectedly modified. Read it again before attempting to write it.
Error 2: "File has not been read yet"
Even after successfully reading a file with the Read tool, using Write fails with:
Error: File has not been read yet. Read it first before writing to it.
Reproduction Steps
- Open Claude Code in Git Bash on Windows
- Read a file:
Read(C:\Users\username\.bashrc) - Immediately try to edit or write to the same file
- Error occurs even though:
- File was not modified by any external process
- File modification timestamp remains unchanged
- No other process is accessing the file
Investigation Results
- File not actually modified: Monitoring
statoutput shows the file mtime does not change between Read and Edit/Write attempts.
- No external process interference: Checked running processes - no file sync tools (OneDrive, Dropbox) or antivirus actively modifying the file.
- Path normalization issue suspected: Git Bash uses different path formats:
- Git Bash style:
/c/Users/username/.bashrc - Windows style:
C:\Users\username\.bashrc - Mixed style:
C:/Users/username/.bashrc
The tool may be tracking file state using different path representations, causing cache misses.
- Encoding issues observed: When reading the file, some content appeared with unusual spacing (possibly null bytes between characters), which could cause hash comparison failures.
Workaround
Using Bash tool with heredoc/cat command works correctly:
cat > ~/.bashrc << 'EOF'
# file content
EOF
Expected Behavior
Edittool should work afterReadtool without errorsWritetool should work afterReadtool without errors- File state tracking should correctly normalize paths on Windows/Git Bash
Additional Context
This issue seems to be related to Windows Git Bash path handling. The internal file state tracking mechanism may need to:
- Normalize all paths to a consistent format before comparison
- Handle Git Bash (MSYS/MINGW) path translations correctly
- Possibly use file handles or inodes instead of path strings for tracking
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗