STUPID-2026-0066
Claude Code moved files into a log/ subfolder, then rm -rf'd the parent directory containing it — 1,500 files gone (GitHub #49129)
Why 7/10
About 1,500 files (50 GB of generated images) were permanently deleted. Large, but confined to one project's data.
- 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
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 *)"
]
}
}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")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)"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)'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.
Instruction given
Reorganize a project directory by moving image files into a log/ subfolder for archiving.
Expected behavior
Move the target files into the log/ subfolder and leave the rest of the parent directory untouched.
Actual behavior
Claude Code moved the image files into sd_auto_generate/log/, then ran rm -rf on the parent directory sd_auto_generate/ itself — deleting the log/ subfolder it had just created, along with everything else in the parent directory. No warning or confirmation was requested before the destructive command ran; Auto-accept edits was enabled.
Damage
Roughly 1,500 PNG files (~50GB of generated image data) were permanently deleted. The reporter was quoted several hundred thousand yen for professional data recovery, or estimated over a month of manual work to reconstruct the data. The user reported this was one of 113+ open Claude Code issues tagged rm-rf/data-loss at the time of filing, with no response from support.
Full write-up
On April 16, 2026, a Claude Code user (running version 2.1.110 with the Sonnet model on Windows 11) filed GitHub issue #49129 after asking the agent to reorganize a project directory by moving image files into a log/ subfolder for archiving. Claude Code moved the files into sd_auto_generate/log/ as instructed — then ran rm -rf on the parent directory sd_auto_generate/ itself. Because log/ sat inside the directory it deleted, every file it had just moved, plus everything else in the parent directory, was destroyed in one command with no warning or confirmation prompt. Claude's own follow-up message acknowledged the mistake: it should have moved log/ outside the parent directory before deleting anything. The reporter marked the failure reproducible every time with the same prompt, and noted it was one of over 113 open Claude Code issues tagged for rm -rf data loss at the time of filing. The issue was later closed as not planned.
Classification
- Agent
- Claude Code
- Failure mode
- Destructive Action
- Root cause
- Scope Misunderstanding
- 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
- Source
- Github Pr
Related incidents
Cite this record
StupidLLM. "STUPID-2026-0066: Claude Code moved files into a log/ subfolder, then rm -rf'd the parent directory containing it — 1,500 files gone (GitHub #49129)." AI Agent Incident Database, 2026. https://www.stupidllm.com/incident/STUPID-2026-0066/ (accessed 2026-11-03). CC BY 4.0.
← STUPID-2026-0065By IDSTUPID-2026-0067 →
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.