[Bug] Edit tool cache not invalidated across conversation sessions
Bug Description
Edit Tool Cache Bug: "File has been unexpectedly modified" in Continued Conversations
Summary
The Edit tool fails with error "File has been unexpectedly modified. Read it again before attempting to write it." when attempting to edit files in a resumed conversation (after context limit/summarization), even though the files have not actually been modified.
Root Cause: Edit tool caches file metadata (likely modification time) across conversation sessions and does not invalidate this cache when a conversation is continued after summarization.
Impact: Makes it impossible to edit previously-accessed files in long conversations, forcing workarounds.
---
Environment
- Claude Code Version: [User to fill in]
- OS: Windows 10/11
- Model: Claude Sonnet 4.5 (claude-sonnet-4-5-20250929)
- Conversation Type: Continued session after context limit reached
---
Reproduction Steps
Prerequisites
- Start a conversation
- Read and/or edit a file (e.g.,
docs/myfile.md) - Continue working until context limit is reached
- Conversation gets summarized and continued in new session
Steps to Reproduce
- In the continued session, attempt to edit the previously-accessed file:
````
Read("docs/myfile.md")
Edit("docs/myfile.md", "old text", "new text")
Expected Behavior
Edit should succeed since the file was just read in the current conversation turn.
Actual Behavior
Error: File has been unexpectedly modified. Read it again before attempting to write it.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.0.55
- Feedback ID: 05ecc90e-3ce3-49f6-833d-aaa8336f3623
Errors
[]This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗