[MODEL] Opus 4.6 deleted a git worktree that was actively being used by another claude code session

Resolved 💬 7 comments Opened Mar 30, 2026 by benjamincburns Closed May 19, 2026

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

  1. Claude completed the first phase of the work
  2. Claude attempted to commit its changes
  3. 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/worktrees dir.
  4. Claude attempted to delete the worktree, but it failed because of sandbox restrictions
  5. Claude bypassed the sandbox and deleted the worktree

Expected Behavior

  1. Claude completed the first phase of the work
  2. Claude attempted to commit its changes
  3. 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/worktrees dir.
  4. 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.:

  1. Set up a JS/TS repo w/ biomejs running via lint-staged via pre-commit hook - don't exclude .claude/worktrees
  2. Ensure that npx biome check passes
  3. Set up a worktree in .claude/worktrees
  4. Ensure that biome check fails due to the addition of the worktree
  5. Run claude the repo root and plan some work in plan mode - be sure to ask claude to commit between phases of the plan
  6. 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" />

View original on GitHub ↗

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