STUPID-2026-0097

Claude Code appended a stray "~/" to a cleanup command and wiped a developer's entire Mac home directory, unrecoverable due to SSD TRIM

9.5critical
December 8, 2025
  1. Instruction given

    Clean up an old repository by removing its tests/, patches/, and plan/ directories.

  2. Expected behavior

    Scope the delete to the three named project directories and leave everything else, including the user's home directory, untouched.

  3. Actual behavior

    Claude Code ran `rm -rf tests/ patches/ plan/ ~/`, appending a trailing `~/` after the three intended targets. The shell expanded `~/` to the user's home directory, and the recursive delete removed Desktop, Documents, Downloads, the Library folder (application state for every installed app), the macOS Keychain, and all local credentials — including Claude Code's own stored authentication.

  4. Damage

    The developer's entire Mac home directory was destroyed: years of project files, personal photos, SSH keys, git config, and every credential stored in Keychain. Because the drive was an SSD with TRIM enabled, freed blocks were zeroed at the controller level, so no forensic or file-recovery tool could bring anything back. The user reported no successful recovery.

A developer using Claude Code (posting on Reddit as u/LovesWorkin) asked the agent to clean up an old repository by removing its `tests/`, `patches/`, and `plan/` directories. Claude Code instead ran `rm -rf tests/ patches/ plan/ ~/` — the trailing `~/` after the three real targets expanded to the user's home directory, and the whole thing was deleted: Desktop, Documents, Downloads, the Library folder, Keychain, SSH keys, and every other credential on the machine, including Claude Code's own login. Because the underlying SSD had TRIM enabled, the freed blocks were zeroed immediately, so none of the standard undelete or forensic recovery approaches could get any of it back. The original report reached roughly 1,500+ upvotes within hours and was amplified by Simon Willison, and Docker's engineering blog later cited it by name as the case study motivating sandboxed execution for coding agents — isolating the agent's filesystem so a `~/` expansion resolves to a disposable workspace rather than the real home directory. This is the same failure class as the root-level `rm -rf` in STUPID-2026-0042 and the EXIT-trap `$HOME` wipe in STUPID-2026-0094, but a distinct mechanism (an unscoped path appended to an otherwise-correct multi-target delete command) on a different platform (macOS rather than WSL2/Ubuntu).

Classification

Failure mode
Destructive Action
Root cause
Tool Misuse
Domain
Infra
Source
Blog Post

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.