[BUG] Critical Bug: Claude Code executed 'rm -rf' and deleted project files unexpectedly
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
While using Claude Code for Flutter development, the AI agent executed an unauthorized rm -rf command which deleted my project directory smart_drive_log.
Evidence: Claude has admitted this was an operational error (Quote: "It was caused by Claude's operational error, not by you.").
Impact: Loss of development time and potential code loss within my daily/weekly usage limits.
Request: I would like to report this critical safety issue and inquire about potential compensation for the wasted usage limits/credits.
What Should Happen?
Permission Check: Claude should never execute destructive commands like rm -rf without explicit user confirmation.
Context Awareness: The agent should distinguish between temporary build artifacts (like build/ in Flutter) and essential source code directories (like smart_drive_log).
Error Recovery: If a file deletion is necessary for a task, Claude should suggest moving it to a backup directory or the system trash instead of permanent deletion.
Quota Protection: Since this operational error wasted my limited daily/weekly usage and 5-hour development window, there should be a mechanism to report such failures and restore usage limits.
Error Messages/Logs
Verified smart_drive_log directory exists but is empty
Verified smart_drive_log directory exists but is empty
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release --no-android-gradle-daemon-jvm-args 2>&1 | head -5 # Try without extra flag TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Could not find an option named "--no-android-gradle-daemon-jvm-args".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt echo "Exit: $?"
Exit code 1
rm: cannot remove '/c/Users/BlairChiu/StudioProjects/smart_drive_log': Device or resource busy
Show more
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ && cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Exit:
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/ 2>/dev/null; echo "cleared"
cleared
Bash
TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Exit:
Bash
pwd
/c/Users/BlairChiu/StudioProjects/smart_drive_log
Bash
ls
Bash
ls /c/Users/BlairChiu/StudioProjects/smart_drive_log/ | head -10
Bash
ls /c/Users/BlairChiu/StudioProjects/
08_smart_drive_log_bak.lnk
flutter_analyze_output.txt
nul
Show more
Glob
pubspec.yaml
No files found
Bash
find /c/Users/BlairChiu/StudioProjects/smart_drive_log -name "pubspec.yaml" 2>/dev/null | head -5
Bash
find /c/Users/BlairChiu/StudioProjects -name "pubspec.yaml" 2>/dev/null | head -5
/c/Users/BlairChiu/StudioProjects/智能雲端行車里程紀錄助手 (Smart Drive Log)/01_30/02_第2天任務_OK/pubspec.yaml
/c/Users/BlairChiu/StudioProjects/智能雲端行車里程紀錄助手 (Smart Drive Log)/31_40/32_All_v1/pubspec.yaml
Bash
ls -la "/c/Users/BlairChiu/StudioProjects/smart_drive_log" 2>&1 | head -20
total 8
drwxr-xr-x 1 BlairChiu 197121 0 Feb 27 01:53 .
drwxr-xr-x 1 BlairChiu 197121 0 Feb 25 00:31 ..
Steps to Reproduce
Steps to Reproduce
*
Please provide clear, numbered steps that anyone can follow to reproduce the issue. Important: Include any necessary code, file contents, or context needed to reproduce the bug. If the issue involves specific files or code, please create a minimal example.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude 1.1.4328 (d8e391) 2026-02-25T17:04:36.000Z
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
Verified smart_drive_log directory exists but is empty
Verified smart_drive_log directory exists but is empty
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release --no-android-gradle-daemon-jvm-args 2>&1 | head -5 # Try without extra flag TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Could not find an option named "--no-android-gradle-daemon-jvm-args".
Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and options.
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt echo "Exit: $?"
Exit code 1
rm: cannot remove '/c/Users/BlairChiu/StudioProjects/smart_drive_log': Device or resource busy
Show more
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/8.14/ && cd /c/Users/BlairChiu/StudioProjects/smart_drive_log && TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Exit:
Bash
rm -rf /c/Users/BlairChiu/.gradle/daemon/ 2>/dev/null; echo "cleared"
cleared
Bash
TEMP="C:/Users/BlairChiu/tmp" TMP="C:/Users/BlairChiu/tmp" flutter build apk --release 2>&1 | tee /c/Users/BlairChiu/build_temp_fix.txt; echo "Exit: $?"
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
Exit:
Bash
pwd
/c/Users/BlairChiu/StudioProjects/smart_drive_log
Bash
ls
Bash
ls /c/Users/BlairChiu/StudioProjects/smart_drive_log/ | head -10
Bash
ls /c/Users/BlairChiu/StudioProjects/
08_smart_drive_log_bak.lnk
flutter_analyze_output.txt
nul
Show more
Glob
pubspec.yaml
No files found
Bash
find /c/Users/BlairChiu/StudioProjects/smart_drive_log -name "pubspec.yaml" 2>/dev/null | head -5
Bash
find /c/Users/BlairChiu/StudioProjects -name "pubspec.yaml" 2>/dev/null | head -5
/c/Users/BlairChiu/StudioProjects/智能雲端行車里程紀錄助手 (Smart Drive Log)/01_30/02_第2天任務_OK/pubspec.yaml
/c/Users/BlairChiu/StudioProjects/智能雲端行車里程紀錄助手 (Smart Drive Log)/31_40/32_All_v1/pubspec.yaml
Bash
ls -la "/c/Users/BlairChiu/StudioProjects/smart_drive_log" 2>&1 | head -20
total 8
drwxr-xr-x 1 BlairChiu 197121 0 Feb 27 01:53 .
drwxr-xr-x 1 BlairChiu 197121 0 Feb 25 00:31 ..
Show less
緊急情況! smart_drive_log 目錄是空的!讓我立即檢查發生了什麼:
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗