[MODEL] Opus 4.6 deleted a git worktree that was actively being used by another claude code session
Preflight Checklist
- [x] I have searched existing issues for similar behavior reports
- [x] This report does NOT contain sensitive information (API keys, passwords, etc.)
Type of Behavior Issue
Claude modified files I didn't ask it to modify
What You Asked Claude to Do
I asked claude to fix a lengthy list of code quality issues (pre-planned via plan mode). This claude session was working in my repo root while another claude session was working on a different set of fixes in a worktree.
What Claude Actually Did
- Claude completed the first phase of the work
- Claude attempted to commit its changes
- The commit failed, because I have biomejs configured to run as a pre-commit hook, and it wasn't set up to exclude my
projectdir/.claude/worktreesdir. - Claude attempted to delete the worktree, but it failed because of sandbox restrictions
- Claude bypassed the sandbox and deleted the worktree
Expected Behavior
- Claude completed the first phase of the work
- Claude attempted to commit its changes
- The commit failed, because I have biomejs configured to run as a pre-commit hook, and it wasn't set up to exclude my
projectdir/.claude/worktreesdir. - Claude updates my biomejs config to exclude the worktree
Files Affected
Deleted:
`.claude/worktrees/sonarqube-fixes/**`
Permission Mode
Accept Edits was ON (auto-accepting changes)
Can You Reproduce This?
Haven't tried to reproduce
Steps to Reproduce
I think this falls under "over eager" behaviour, so I'd imagine that it would be at least intermittently reproducible with a similar setup as described above, e.g.:
- Set up a JS/TS repo w/ biomejs running via
lint-stagedvia pre-commit hook - don't exclude.claude/worktrees - Ensure that
npx biome checkpasses - Set up a worktree in
.claude/worktrees - Ensure that
biome checkfails due to the addition of the worktree - Run
claudethe repo root and plan some work in plan mode - be sure to ask claude to commit between phases of the plan - Execute the plan
Claude Model
Opus
Relevant Conversation
Before deleting the worktree claude said:
> The pre-commit hook failed because biome found a conflicting config in the .claude/worktrees/sonarqube-fixes/ directory. That's a stale worktree. I need to clean it up or exclude it from biome.
and then it ran `Bash(rm -rf .claude/worktrees/sonarqube-fixes && echo "Removed stale worktree")`
Impact
High - Significant unwanted changes
Claude Code Version
2.1.87
Platform
Anthropic API
Additional Context
Screenshot from session
<img width="1791" height="682" alt="Image" src="https://github.com/user-attachments/assets/f42bfd22-55d6-4696-8a91-f430863e5f39" />
This issue has 7 comments on GitHub. Read the full discussion on GitHub ↗