STUPID-2026-0075

Claude Code's parallel-subagent worktree cleanup deleted the main .git directory and entire working tree — irrecoverable repo loss (GitHub #48927)

7.0high
April 16, 2026Source checkedRepro reported

Why 7/10

The repository's .git and working tree were destroyed with no remote: irrecoverable, confined to one project.

Scope
2/4
One project, repository, server or service, or a cost above roughly $10,000
Recoverability
3/3
Permanently lost or irreversible, including data that was exposed
Did it happen
2/2
Happened in real use
Beyond the user
0/1
Only the user's own non-production work

The score is the sum of these four factors. How each factor is scored · scored 2026-10-29

  1. 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.

  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.

  3. 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.

  4. 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.

Full write-up

On April 16, 2026, a Claude Code user (version 2.1.109, Opus model, Ubuntu/Debian Linux, Anthropic API) filed GitHub issue #48927 describing total loss of a git repository after running two successive rounds of parallel subagents isolated with Claude Code's isolation: worktree feature. The first round — four subagents implementing modules M06, M02, M01 and M04 on branch dev/mode-2 — finished after about 15 minutes and produced four successful commits (55a4fe3 through 88b6f9c). A second round of four subagents (M07, M03, M05, M01-deploy) was then launched; when it finished about eight minutes later, the next git command failed with fatal: not a git repository (or any of the parent directories): .git. The repository's .git directory, all pre-existing source code, docs/, tests/, README.md, configuration files, and the four commits from the first round were gone. Only a few files written by the second round's subagents — install.sh, uninstall.sh, pyproject.toml — survived. The reporter's diagnosis, backed by detailed reproduction steps, was that the worktree cleanup mechanism operated on the main working tree rather than confining itself to the isolated worktree directories — a scope/path-confusion bug in the cleanup logic rather than a single bad command. No remote backup existed, so the loss was irrecoverable. GitHub labeled the issue data-loss and has repro; it was closed as not planned.

Classification

Failure mode
Destructive Action
Domain
Other
OWASP Agentic Top 10 (our mapping)
ASI02 Tool Misuse and Exploitation list
MIT AI Risk Repository (our mapping)
7.3 Lack of capability or robustness taxonomy

Related incidents

Cite this record
StupidLLM. "STUPID-2026-0075: Claude Code's parallel-subagent worktree cleanup deleted the main .git directory and entire working tree — irrecoverable repo loss (GitHub #48927)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0075/ (accessed 2026-11-11). CC BY 4.0.

← STUPID-2026-0074By IDSTUPID-2026-0076 →

Get told when an agent breaks something

We document AI agent failures daily, severity-scored against a published scale. Each Monday, if any scored 7 or above that week — deleted data, leaked secrets, broken production — you get one email with the sources. When nothing did, you get nothing.

This database is callable over MCP — query it from inside your agent.