Windows: Path normalization bug breaks Read/Edit/Write tracking with forward slashes
Description
On Windows (Git Bash), the Read tool and Edit/Write tools don't properly normalize file paths, causing false "File has been unexpectedly modified" errors.
Environment
- OS: Windows 10 (MINGW64_NT-10.0-19045)
- Shell: Git Bash
- Claude Code version: Latest
Steps to Reproduce
- Have a file on a secondary drive, e.g.,
E:/Docs/test.txt - Read the file using forward slashes:
````
Read: E:/Docs/test.txt
- Immediately try to edit:
````
Edit: E:/Docs/test.txt
old_string: "test"
new_string: "test2"
Expected Behavior
Edit should work since the file was just read and not modified.
Actual Behavior
Error: File has been unexpectedly modified. Read it again before attempting to write it.
The file was NOT actually modified — confirmed via stat showing unchanged modification time.
Root Cause
The Read tool stores the path in one format, but Edit/Write compares using a different format. They don't match due to inconsistent path normalization (forward slashes vs backslashes).
Workaround
Using backslashes works correctly:
Read: E:\Docs\test.txt
Edit: E:\Docs\test.txt <- Works!
Additional Context
- Files in the main working directory (C: drive) work fine
- Bash commands with forward slashes work fine
- Only affects Read/Edit/Write tool path tracking on secondary drives
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗