[BUG] Edit tool incorrectly reports "File has been unexpectedly modified" when using absolute paths

Resolved 💬 2 comments Opened Feb 11, 2026 by chrisbyrd Closed Feb 11, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

The Edit tool consistently fails with a false positive "file modified" error when using absolute Windows paths, even when no actual modification has occurred between Read and Edit operations.

What Should Happen?

Both absolute and relative paths should work consistently. The Edit tool should recognize that C:/Dev/Projects/Firmware/Supervisor/SupervisorFirmwareV3/components/platform/security/certificate_provisioning_service.hpp and components/platform/security/certificate_provisioning_service.hpp refer to the same file when the working directory is c:\Dev\Projects\Firmware\Supervisor\SupervisorFirmwareV3.

Error Messages/Logs

Error: File has been unexpectedly modified. Read it again before attempting to write it.

Steps to Reproduce

  1. Call Read with an absolute Windows path (e.g., C:/Dev/Projects/Firmware/Supervisor/SupervisorFirmwareV3/components/platform/security/certificate_provisioning_service.hpp)
  2. Immediately call Edit on the same file using the same absolute path
  3. Error occurs: "File has been unexpectedly modified. Read it again before attempting to write it."
  4. Call Read again with a relative path (e.g., components/platform/security/certificate_provisioning_service.hpp)
  5. Call Edit with the same relative path
  6. Edit succeeds

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

 2.1.0

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

Root Cause Hypothesis
The Edit tool appears to track file state using the exact path string provided, without normalizing for:

  • Absolute vs relative paths
  • Forward slashes vs backslashes on Windows
  • Drive letter case sensitivity (C: vs c:)

When Read uses C:/Dev/... and Edit uses the same string, the tool doesn't recognize them as the same file internally, triggering the false "modified" error.

Workaround
Consistently use relative paths for both Read and Edit operations.

Impact
This causes friction in the user experience, requiring users to manually intervene and tell Claude to "use relative paths" when this error occurs. It breaks the flow of automated file editing tasks.

<img width="1113" height="695" alt="Image" src="https://github.com/user-attachments/assets/3e83cb06-260d-491f-a1fc-15747308cd2b" />

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗