[BUG] Windows: Edit and Write rename the file to the letter case used in file_path

Status Open
Reported on v2.1.295
Maintainer reply None cached
Activity 1 comment · opened Oct 10, 2026

What's Wrong?

On Windows the file system is case-insensitive but keeps each name's case. When file_path names an existing file with different letter case, Edit and Write update the file and rename it to the case in file_path.

Case.txt edited as ...\case.TXT is now called case.TXT on disk. The model often types a path with different case than the real name, so this happens without anyone asking for a rename.

The tool says only "has been updated successfully".

Why it matters

  • With core.ignorecase=true (the Windows default) git status shows M Case.txt, so nobody notices. With core.ignorecase=false, or in WSL, a container or any case-sensitive checkout of the same working tree, it is D Case.txt plus ?? case.txt.
  • Anything that copies the working tree to a case-sensitive place (FTP/rsync deploys, docker build contexts, zip uploads) now ships the new name, and imports or links that use the old case break there.
  • Case-checking tools (forceConsistentCasingInFileNames in TypeScript, webpack's case-sensitive-paths plugin) start failing on code that did not change.

What Should Happen?

Writing to an existing file keeps its name exactly as it is on disk, as every ordinary write does.

Steps to Reproduce

  1. Create Sub\Case.txt containing fruit = APPLE. Read it.
  2. Edit with file_path: ...\sub\case.TXT, old_string: APPLE, new_string: ORANGE.
  3. ls Sub → case.TXT (was Case.txt). The folder Sub keeps its case; only the file is renamed.
  4. Same with Write: Read WriteCase.txt, Write to ...\writecase.txt → the file is now writecase.txt.

Control on the same machine and folder: PowerShell Set-Content -LiteralPath ...\ctrl.TXT and Python open(r'...\ctrl.TXT', 'a') both change the contents of Ctrl.txt and leave its name as Ctrl.txt.

Edit with forward slashes, or with a lowercase drive letter, changes nothing but the contents, as expected.

Environment

  • Claude Code 2.1.295 (Claude Desktop's Code tab), Windows 11, NTFS
  • Edit and Write called directly; the model and prompt play no part
  • The 2.1.296 changelog has no entry for this; I could not run 2.1.296 itself here

(Likely cause: the new contents are written to a temporary file and renamed onto file_path, so the rename takes the case of file_path.)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗