-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
What's Wrong?
Description:
The Edit and Write tools fail with "File has been unexpectedly modified" even when the file is provably unchanged. This appears to
be caused by stale background shell state that incorrectly persists after shells have completed.
Steps to Reproduce:
- Start Firebase emulators in background: firebase emulators:start with run_in_background: true
- Kill the emulator processes (taskkill or Ctrl+C)
- Attempt to edit any file with the Edit tool
Observed Behavior:
- KillShell returns status: completed or status: killed for all background shells
- System reminders continue to appear claiming shells are status: running with "new output available"
- Edit tool fails with "File has been unexpectedly modified"
- Write tool fails with "File has not been read yet" even immediately after Read
- File hash (md5sum) confirms file is unchanged
- File timestamp confirms file is unchanged
Expected Behavior:
- Shell status should be consistent between KillShell responses and system reminders
- File modification detection should use actual file state, not be affected by unrelated shell tracking
- Edit/Write should succeed when file is unchanged
Environment:
- Platform: Windows (win32)
- Working directory on V: drive (possibly mapped/virtual drive)
- Multiple background shells were spawned during session
Evidence:
KillShell says completed:
Shell ee9b0a is not running, so cannot be killed (status: completed)
But system reminder says running:
Background Bash ee9b0a (command: ...) (status: running) Has new output available
File hash unchanged:
a29eb961536944249c6ec4d795eab161 (before)
a29eb961536944249c6ec4d795eab161 (after 2 second delay)
Workaround:
Start a new conversation to clear the corrupted shell tracking state.
What Should Happen?
File should be editable
Error Messages/Logs
Steps to Reproduce
Just try editing a file.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
not sure
Claude Code Version
2.0.60 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
No response