STUPID-2026-0136

Claude Code's rm -rf followed a pnpm NTFS junction out of a Next.js template and wiped a developer's entire C:\Users profile — 165GB, 1.6M files (GitHub #36339)

8.0high
March 19, 2026Source checkedRepro reported

Why 8/10

A 165 GB user profile, including a company's business data, was deleted. Recovery was still in progress at filing, so permanence is unconfirmed.

Scope
3/4
A whole machine or drive, an organisation's production system or data, or many credentials
Recoverability
2/3
Partly lost, or loss reported without saying whether it was recovered
Did it happen
2/2
Happened in real use
Beyond the user
1/1
Production systems, customers or third parties, or credentials and sensitive personal data

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

Status and what to do

Affected
Claude Code 2.1.51 in Git Bash on Windows 11, run with --dangerously-skip-permissions, on a pnpm project whose node_modules used NTFS junctions.
Fix status
No fix linked · The GitHub issue was marked a duplicate and closed as not planned by the stale bot on 1 May 2026, with no fix linked.
Mitigation
Claude Code's docs say that on native Windows it runs shell commands unsandboxed; its sandbox, which by default lets commands write only to the working directory, a temp directory and folders you add, runs on macOS, Linux and WSL2. On Windows, run Claude Code inside WSL2 to get it. Running without --dangerously-skip-permissions also keeps the approval prompt before deletes. Source
Last reviewed
2026-10-29 · Report a correction to this record

Guardrail rules for this command

Recursive deletes: make your agent stop and ask before running these. Free to copy; written in each tool’s documented format.

Claude Code · the agent in this incident
{
  "permissions": {
    "ask": [
      "Bash(rm -r*)",
      "Bash(rm -fr*)",
      "Bash(rm -R*)",
      "Bash(find * -delete*)",
      "PowerShell(Remove-Item *)",
      "Bash(cmd /c rmdir *)",
      "Bash(cmd /c del *)"
    ]
  }
}
Add to .claude/settings.json in the project (or ~/.claude/settings.json for every project). Each matching command then asks you first, including in auto mode.

Stronger control: Turn on the sandbox (/sandbox): shell commands can then write only to the project, a temp folder and directories you add. It runs on macOS, Linux and WSL2; on native Windows Claude Code runs commands unsandboxed. Docs

Codex
prefix_rule(pattern = ["rm", ["-r", "-rf", "-fr", "-R"]], decision = "prompt", justification = "Recursive delete: confirm the target first")
Save as ~/.codex/rules/stupidllm.rules and restart Codex. Codex's docs describe rules as controlling commands run outside its sandbox, and mark them experimental.

Stronger control: Keep Codex's OS sandbox on (it limits writes, typically to the workspace) and leave approvals on for sessions that can reach data you cannot lose. Docs

Gemini CLI
[[rule]]
toolName = "run_shell_command"
commandPrefix = ["rm -r", "rm -fr", "rm -R"]
decision = "ask_user"
priority = 100
denyMessage = "Destructive command: needs a human to confirm (stupidllm.com)"
Save as ~/.gemini/policies/stupidllm.toml. Workspace-level policy files are disabled in Gemini CLI, so this must be the user-level folder.

Stronger control: Policies in ~/.gemini/policies apply in every approval mode unless a rule's modes field narrows them. Docs

Copilot CLI
copilot --deny-tool='shell(rm)'
Pass on the command line. Copilot CLI matches the program name (and git/gh subcommands), so this blocks the whole command, not just its dangerous form.

Stronger control: Avoid --allow-all-tools on a machine with data you cannot lose; --deny-tool takes precedence over it. Docs

What these cannot do: a pattern rule matches the command text the agent writes. In Anthropic’s words it “isn’t a security boundary around the program”: /bin/rm, sh -c or a script that runs the same thing gets past it (STUPID-2026-0124 got past a guard with cmd /c). Use the sandbox as well, and keep backups of what you cannot lose.

  1. Instruction given

    Using Claude Code v2.1.51 in Git Bash on Windows 11 with --dangerously-skip-permissions, scaffold a Next.js + Payload CMS project via `pnpm dlx degit` and resolve an incompatible workspace dependency.

  2. Expected behavior

    Delete only the newly scaffolded template folder; detect that pnpm had populated it with NTFS junctions rather than real directories before running any recursive delete, and never let a cleanup command escape the project folder into the user's home directory.

  3. Actual behavior

    After finding `workspace:*` dependencies incompatible with a standalone install, Claude Code ran `rm -rf /c/Users/guido/aldaba-v2` in Git Bash. pnpm had wired the template's node_modules with NTFS junction points; Git Bash's rm followed them as real directories instead of removing the links, and the delete escaped the project folder into the surrounding C:\Users\guido profile. No confirmation, warning, or error was shown before or during the deletion.

  4. Damage

    The reporter says the entire C:\Users\guido profile was destroyed — roughly 165.66GB across 1,593,350 files and 276,382 folders, including personal files, AppData, and active business data for a company. The user only noticed when the Desktop was empty. At the time of filing, recovery via a paid NTFS recovery tool was still in progress and no data had been recovered. The issue was filed with `data-loss` and `has repro` labels and ultimately closed as not planned, with no fix linked in the report; it cites two prior, similar junction-traversal deletion reports (#29249, #29023) as related issues.

Full write-up

On March 19, 2026, a developer using Claude Code v2.1.51 in Git Bash on Windows 11 filed GitHub issue #36339 after the agent destroyed their entire C:\Users\guido profile while cleaning up a scaffolded project. The agent had run pnpm dlx degit payloadcms/payload/templates/website aldaba-v2 to create a Next.js and Payload CMS starter, then found the template's workspace:* dependencies incompatible with a standalone install and ran rm -rf /c/Users/guido/aldaba-v2 to remove it.

pnpm had populated the template's node_modules with NTFS junction points rather than ordinary directories or symlinks. Git Bash's rm -rf follows NTFS junctions into their real targets instead of deleting the link itself — the same gap already fixed in PowerShell Core 6+ but never backported to the Windows tooling Claude Code's Bash tool shells out to. The recursive delete escaped the project folder entirely and tore through the user's home directory: the reporter estimates 165.66GB across 1,593,350 files and 276,382 folders were destroyed, including personal files, AppData, and data for an active business. No warning or confirmation preceded the deletion; the user discovered it only after noticing the Desktop was empty.

The issue was filed with bug, data-loss, and has repro labels and cites two earlier, similar junction-traversal deletions (#29249, #29023) as related reports — the same failure class recurring across different Windows package managers and projects. A GitHub Actions bot closed it as stale and "not planned" roughly six weeks later with no maintainer response, and no fix was linked to this report.

Classification

Failure mode
Destructive Action
Domain
Infra
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-0136: Claude Code's rm -rf followed a pnpm NTFS junction out of a Next.js template and wiped a developer's entire C:\Users profile — 165GB, 1.6M files (GitHub #36339)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0136/ (accessed 2026-11-11). CC BY 4.0.

← STUPID-2026-0135By IDSTUPID-2026-0137 →

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.