claude-code - 💡(How to fix) Fix [Data Loss] Claude Code executed rm -rf and permanently deleted ~1500 files / ~50GB [3 comments, 4 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49129Fetched 2026-04-17 08:50:04
View on GitHub
Comments
3
Participants
4
Timeline
10
Reactions
0
Author
Timeline (top)
labeled ×5commented ×3cross-referenced ×1subscribed ×1

Code Example



---

Claude said: "私のミスです。`log/` を `sd_auto_generate/` の外に移してから削除すべきでした。"

[Claude acknowledged the mistake after the fact. The rm -rf had already been executed and all data was permanently deleted.]

Session ID: 6308ffd3-f6e6-4fda-b32a-1f87ec219d33
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues for similar behavior reports
  • This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Claude modified files I didn't ask it to modify

What You Asked Claude to Do

I asked Claude Code to help reorganize project directories. Specifically, I asked it to move image files to a log/ subfolder for archiving.

What Claude Actually Did

  1. Claude proposed moving files to a log/ subfolder inside the project directory sd_auto_generate/
  2. Claude moved the image files into sd_auto_generate/log/
  3. Claude then executed rm -rf on the parent directory sd_auto_generate/
  4. Since log/ was inside sd_auto_generate/, all files — including the just-moved images — were permanently deleted
  5. No warning was given before the destructive operation
  6. No confirmation was requested before executing rm -rf

Expected Behavior

Claude should have:

  1. Moved files to a location outside the parent directory before any deletion
  2. Never executed rm -rf on a directory containing user data without explicit confirmation
  3. At minimum, warned the user before any destructive operation and waited for approval

Files Affected

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Yes, every time with the same prompt

Steps to Reproduce

Impact

  • ~1500 PNG files permanently deleted
  • ~50GB of irreplaceable generated image data lost
  • Professional recovery service estimate: several hundred thousand JPY
  • Self-recovery estimate: 1+ month of manual work

Session Info

  • Date: 2026-04-16
  • Session ID: 6308ffd3-f6e6-4fda-b32a-1f87ec219d33
  • Claude Code version: 2.1.110
  • OS: Windows 11 Home

Note

Support email was submitted on the same day. No response received yet. This is part of a widespread known issue (113+ open issues tagged rm -rf / data-loss).

Claude Model

Sonnet

Relevant Conversation

Claude said: "私のミスです。`log/``sd_auto_generate/` の外に移してから削除すべきでした。"

[Claude acknowledged the mistake after the fact. The rm -rf had already been executed and all data was permanently deleted.]

Session ID: 6308ffd3-f6e6-4fda-b32a-1f87ec219d33

Impact

Critical - Data loss or corrupted project

Claude Code Version

2.1.110 (Claude Code)

Platform

Anthropic API

Additional Context

No response

extent analysis

TL;DR

To prevent similar data loss incidents, ensure Claude Code moves files to a location outside the parent directory before any deletion and requires explicit user confirmation for destructive operations like rm -rf.

Guidance

  • Review the conversation history to understand the sequence of commands that led to the data loss, focusing on the rm -rf execution.
  • Verify that the current version of Claude Code (2.1.110) has any known issues or updates related to handling file movements and deletions, especially concerning the Sonnet model.
  • Consider disabling the "Accept Edits" feature to prevent auto-accepting changes that could lead to unintended file deletions.
  • Test the reorganization process with a small, non-critical dataset to ensure Claude Code behaves as expected before applying it to larger projects.

Example

No specific code snippet can be provided without knowing the exact API calls or commands used by Claude Code. However, ensuring that any file operation script or command includes a confirmation step before executing rm -rf is crucial.

Notes

The provided information suggests a widespread issue with Claude Code's handling of file operations, indicated by 113+ open issues tagged with rm -rf and data-loss. This implies that the problem may not be isolated and could require a fix from the developers of Claude Code.

Recommendation

Apply a workaround by disabling auto-acceptance of changes and manually verifying each step of the file reorganization process to prevent unintended deletions, until a fixed version of Claude Code is available that addresses these issues.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING