STUPID-2026-0075
Claude Code's parallel-subagent worktree cleanup deleted the main .git directory and entire working tree — irrecoverable repo loss (GitHub #48927)
Instruction given
Run two successive rounds of four parallel subagents, each isolated with Claude Code's `isolation: worktree` feature, to implement separate modules of a project on branch dev/mode-2.
Expected behavior
Each subagent's worktree cleanup should remove only that subagent's own isolated worktree directory, leaving the main working tree, the .git directory, and all committed history untouched.
Actual behavior
The first round of four subagents completed and committed successfully (commits 55a4fe3 through 88b6f9c). During cleanup of the second round of four worktree-isolated subagents, the cleanup mechanism operated on the main working tree instead of, or in addition to, the isolated worktree directories. A subsequent git command failed with "fatal: not a git repository (or any of the parent directories): .git" — the .git directory was gone.
Damage
Complete, irrecoverable loss of the repository's .git directory (and with it all commit history), all pre-existing source code, the docs/ and tests/ directories, README.md, and configuration files, plus the four commits produced by the first round of subagents. Only a handful of files written by the second round of subagents survived (install.sh, uninstall.sh, pyproject.toml). No remote backup existed. GitHub labeled the issue data-loss and has-repro; it was closed as not planned.
Classification
- Agent
- Claude Code
- Failure mode
- Destructive Action
- Root cause
- Scope Misunderstanding
- Domain
- Other
- Source
- Github Issue
Related incidents
Get told when an agent breaks something
We document AI agent failures daily, severity-scored against a published scale. When one lands at 7.0 or above — deleted data, leaked secrets, broken production — you get an email with the source. When nothing does, you get nothing.
This database is callable over MCP — query it from inside your agent.