claude-code
claude-code copied to clipboard
[Bug] Edit tool reports file modified when hash unchanged on Windows with autocrlf
Bug Description Bug Report Summary
Issue: Edit tool reports "File has been unexpectedly modified" when the file hasn't actually changed
Evidence:
- md5sum shows file hash remains constant across multiple reads
- No external processes modifying files (verified by killing Jest watcher)
- VS Code was closed during testing
- package.json edits work fine, but .ts and .md files consistently fail
- Issue persists even with empty file watcher list
Environment:
- Windows 10 (version 10.0.26200.7171)
- Git Bash shell
- core.autocrlf=true in git config
- Claude Code CLI via npm
Steps to reproduce:
- Read a .ts or .md file
- Immediately attempt an Edit
- Error occurs even though file hasn't changed
Workaround: Use Write to create new file + mv to replace, or use sed for inline edits
Environment Info
- Platform: win32
- Terminal: null
- Version: 2.0.55
- Feedback ID: 6507f856-8081-4bb6-b62e-a593f1c7d6bb
Errors
This issue started all of a sudden for me today...was working fine yesterday...anyone have a workaround?
I've been encountering this too. It is frustrating since it means CC is burning extra tokens in repeated attempts to modify files. It appears to happen only for Opus 4.5 on my machine (win11, latest version of everything).