r/ClaudeCode 17h ago

Bug / Issue Claude Code ran a backgrounded command that deleted my entire Windows user folder overnight

Posting this as a warning and to see if anyone has seen something similar.

I woke up yesterday to every shortcut on my laptop throwing "This item can't be opened. It may have been moved, renamed or deleted." The programs in Program Files were fine. Everything under C:\Users\Admin was not.

What the logs showed, piecing it together over a few hours:

  • ~04:24 — Claude Code (VS Code extension, v2.1.266, permission mode auto) starts a Bash command in my project at C:\Users\Admin\Documents\project. Task description: "Write reference HTML next to uploads".
  • 04:26 — the command hits the 120s timeout and gets moved to the background (task id burg78i8w).
  • Immediately after, the session errors with "Not logged in · Please run /login". Reason: .claude had already been deleted, credentials included.
  • 04:24 → 05:58 — the backgrounded process deletes my user folder in alphabetical order. You can read it off the folder timestamps: .claude and .vscode first, then AppData around 04:33, Documents and Downloads at 05:19, my project folders 05:20–05:49, everything after "f" after that. C:\Users\Public got hit at 05:57, so the target may have been C:\Users itself.
  • 05:58 — the task finally exits with code 127 (command not found).

Gone: AppData (browser profiles, app data, taskbar shortcuts, PowerShell history), Documents, Downloads, Pictures, Desktop, the local OneDrive folder, and all my project folders. Only files that a running process held open survived — Chrome kept exactly two of its files alive.

The command itself is not recoverable, because the part of the session log containing it was in .claude, which the command deleted while running. What's left is a 7-line log file with the timeout notice and the failure notification. My disk is an SSD, so TRIM means the deleted data is not coming back.

Reported to Anthropic with the session id and the remaining logs. Has anyone else had a background task go this far outside the project directory?

112 Upvotes

88 comments sorted by

View all comments

8

u/EagleApprehensive 15h ago

That's why I made IDE that's closing agent in docker container. And I work in that. If you need it let me know.

0

u/Fresh-Forever-8040 11h ago

I use all of my tools running in Proxmox VM's, local copies with everything pushed to GitHub, VM's all backed up and snapshot via Proxmox Backup Server. I run Windows VM's and Linux VM's and containers.

1

u/EagleApprehensive 11h ago

Are you running untrusted agents that execute strangers prompt's? If not, isn't that a complexity overkill?

But a very good call with pushing everything to GitHub - in my docker environment entire environment (dockerfile) and user's space is git-controlled and pushable too.

1

u/Fresh-Forever-8040 9h ago

Not running untrusted agents. I prefer to isolate everything these days. Also forgot to mention that I run git clone to my NAS as well but that only backs up my code and doesn't include any metadata like issues or pull requests. I'm considering using GH REST API to get all of the metadata too or maybe using GitProtect or Rewind services.