STUPID-2026-0129

Claude Code's own `git worktree remove --force` followed NTFS junctions and destroyed their targets on an emergency disk reclaim, while shell-level Remove-Item, rm -rf and shutil.rmtree all left the same junctions untouched (GitHub #84162)

7.0high
July 8, 2026VerifiedReproducible
  1. Instruction given

    No explicit instruction to delete anything. Claude Code automatically creates an isolated git worktree per isolated agent and per workflow step on Windows; none of the resulting worktrees were ever auto-removed, so they accumulated to 136 registered worktrees (~130GB, ~945,000 files) by the time of filing. On 2026-07-08, the user ran an emergency disk-space reclaim that called `git worktree remove --force` on the accumulated worktrees.

  2. Expected behavior

    Removing a worktree directory should remove only that worktree. Where a worktree's `node_modules` (or any other path inside it) contains an NTFS directory junction pointing elsewhere on disk — including back into the main tree's own data directories — the removal should delete the junction link itself, not recurse into whatever it points to.

  3. Actual behavior

    `git worktree remove --force` recursed through the NTFS junctions and deleted their targets outright, destroying files outside the worktree being removed; the junction's directory shell was left behind with its contents gone. The reporter isolated the exact mechanism by testing five different removal methods against the same junctioned worktree: PowerShell 7.5.8 `Remove-Item`, Windows PowerShell 5.1 `Remove-Item`, Git Bash `rm -rf`, and Python's `shutil.rmtree` all left the junction target intact — only `git worktree remove --force` followed the link and destroyed what it pointed to. A full night of remediation afterward reclaimed zero bytes, because every one of the 136 worktrees had to be individually proven safe to remove before touching it.

  4. Damage

    The junction targets reached by the 2026-07-08 `git worktree remove --force` run were destroyed — files gone, empty directory shells left behind — though the issue does not quantify how much data that run destroyed specifically; the 130GB/945,000-file figure is the size of the worktree backlog at filing time, not the measured loss. About 30% of one week's usage was spent on diagnosis and cleanup that recovered nothing. The issue was filed with the `area:core` label, received no maintainer response, and was closed as not planned.

On August 5, 2026, a Claude Code user (ThatDragonOverThere) filed anthropics/claude-code issue #84162 describing a Windows-specific data-loss mechanism inside the product's own worktree cleanup. Claude Code creates an isolated git worktree for each isolated agent and each workflow step; on this user's machine none of them were ever automatically removed, and they had piled up to 136 registered worktrees — roughly 130GB and 945,000 files — by the time the issue was filed. On July 8, 2026, the user ran an emergency disk-space reclaim that called `git worktree remove --force` across the backlog. Several of the accumulated worktrees had `node_modules` directories containing NTFS junctions — created by the package manager to point back into the main tree's data directories — and `git worktree remove --force` followed those junctions and deleted what they pointed to, rather than deleting the junction link itself. The directory shells at the junction paths survived; their contents did not. What makes the report unusually solid is the reporter's isolation of the exact culprit. Suspecting any recursive-delete tool might be at fault, they tested five different removal methods against the same junctioned worktree: PowerShell 7.5.8's `Remove-Item`, Windows PowerShell 5.1's `Remove-Item`, Git Bash's `rm -rf`, and Python's `shutil.rmtree` all left the junction target untouched. Only git's own `worktree remove --force` recursed into it and destroyed the contents — a narrower and more specific finding than earlier junction-related Claude Code reports, which had implicated the shell-level delete commands themselves (see STUPID-2026-0123) rather than git's built-in worktree removal. The remediation that followed reclaimed nothing: each of the 136 worktrees had to be individually proven safe before it could be removed, consuming about 30% of the user's week. The issue carries the `area:core` label, drew no maintainer response, and was closed as not planned.

Classification

Failure mode
Destructive Action
Root cause
Tool Misuse
Domain
Infra

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.