[BUG] Windows: Edit and Write rename the file to the letter case used in file_path
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 statusshowsM Case.txt, so nobody notices. Withcore.ignorecase=false, or in WSL, a container or any case-sensitive checkout of the same working tree, it isD Case.txtplus?? case.txt. - Anything that copies the working tree to a case-sensitive place (FTP/rsync deploys,
docker buildcontexts, zip uploads) now ships the new name, and imports or links that use the old case break there. - Case-checking tools (
forceConsistentCasingInFileNamesin 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
- Create
Sub\Case.txtcontainingfruit = APPLE. Read it. - Edit with
file_path: ...\sub\case.TXT,old_string: APPLE,new_string: ORANGE. ls Sub→case.TXT(wasCase.txt). The folderSubkeeps its case; only the file is renamed.- Same with Write: Read
WriteCase.txt, Write to...\writecase.txt→ the file is nowwritecase.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.)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗