claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Edit tool reports file modified when hash unchanged on Windows with autocrlf

Open cerkon1 opened this issue 4 weeks ago • 2 comments

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:

  1. Read a .ts or .md file
  2. Immediately attempt an Edit
  3. 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

cerkon1 avatar Nov 29 '25 10:11 cerkon1

This issue started all of a sudden for me today...was working fine yesterday...anyone have a workaround?

devildog67 avatar Dec 10 '25 17:12 devildog67

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).

sethb75 avatar Dec 12 '25 16:12 sethb75