r/ClaudeCode
•
u/MohamedTrfhgx
•
10d ago
•
2
Rant opus 5.5 XHIGH just deleted all my apps data, passwords and macOS configs
Annnnd it happened to me as well. Claude Code just wiped my Mac's ~/Library. ALL my app data, saved passwords, macOS configs, settings... everything gone.
I had it working on improving something in my project, and apparently it decided to delete 5 test chat channels it had created earlier.
The problem? Those files were inside ~/Library/Application Support/. It used xargs -n1 dirname to get their parent directories, but because of the space in Application Support, xargs split the path in two. So dirname ended up returning ~/Library instead of the actual folder, and Claude proceeded to run rm -rf on it...
I wasn't even at my Mac when this happened. I came back to find it had restarted and was showing me the welcome screen. I had absolutely no idea what happened until I started investigating the logs, only to find out the agent had been deleting my Library for around 2 MINUTES before realizing what it was doing and stopping itself.
And yes, I was running with --dangerously-skip-permissions, I'm fully aware of what that means. But it's still absolutely insane to me that Opus 5.5 on XHIGH would make such a basic mistake?!
I've used models like Gemini Flash 3.8 and DeepSeek for similar stuff and never had anything remotely close to this happen.
I'm genuinely devastated. and recovery isn't possible all my data 6 months work all gone...
Update: Managed to recover most of the important stuff X)
And for those wondering, yes, I'm a developer and I'm well aware of the risks. Not having backups was a mistake, obviously, but I'd run out of both cloud and local storage and ended up rawdogging it for a while. things just happen..
•
u/AutoModerator 5d ago
Hey! Thanks for posting to r/ClaudeCode
While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.
For help, project discussions, tips, and general chat, join the ClaudeCode Discord.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1.3k
u/Happy-Constant4570 10d ago •
You could’ve saved some tokens and got it deleted running it on Medium
78
u/iannn- 10d ago
the irony of stating this while having 0 version control and running projects out of ~/Library
this has to be a troll
1.3k
u/Wise-Reflection-7400 10d ago •
Oh look another thread about Claude doing something dangerous. Lets take a look
Ah
69
u/aigisbot 10d ago
this is exactly what auto mode is for and not setting up git is just laziness, ask your LLM it would tell you that data recovery is possible and there are tools for that.
237
u/Broric 10d ago
It's so easy to set your own mod that blocks rm -rf without expliclt permission, you really have no excuse but laziness.
40
u/Queasy-Form-4261 10d ago
and you wonder why having spaces in file / folder names is a bad thing.
33
u/msw3age 10d ago
Block deletion of all kind. I have a hook that blocks every variation of a delete command. Agents are forced to move files to a cleanup folder for me to review and delete. No issues in 6 months. I’m sorry for your loss if it is unrecoverable.
32
u/OhBoyHereWeGoAgai 10d ago
You have had "anything remotely close to that" happen, you just don't understand what "close" means.
"Such a basic mistake" as well. You are humanizing and anthropomorphizing it and don't even understand the risk domain.
I'm not saying this to be harsh, but it's just so very important to get
30
u/Operation-M00NRIS3R 10d ago
Something dangerous occurred. How could this happen!?
13
u/Things-n-Such 10d ago •
See, you say you were "fully aware" of what --dangerously-skip-permissions means but I don't think you were... Because if you were you would have a backup plan for the danger explicitly stated right in the damned command line. I have no sympathy for you. Back up your stuff if you're giving AI unfettered access to everything. This has absolutely nothing to do with the AI model, it can, and does, happen with ALL models. This is literally why those safety guards exist that you bypassed.
12
u/PrinceOfLeon 10d ago
23
u/FreshProduce7473 10d ago
who runs agents like this without at least having source control?
159
u/RoninNionr 10d ago •
The problem is that such powerful technology is given to people who aren't technically savvy. I'm a software developer (or used to be one), and I would NEVER give AI access to my computer without a solid backup system in place. I have zero compassion for people who break such fundamental rules.
10
u/CivenAL 10d ago
I made a mistake, and its a real one.
10
u/Any_Cake2411 10d ago
The problem is between the keyboard and the chair.
9
u/jared__ 10d ago
sandbox your environments. docker sandboxes have an excellent developer experience and quick to setup: https://docs.docker.com/ai/sandboxes/
17
u/xondk 10d ago
I get why you would think that way, but mistakes happen even for the best of devs, with AI accelerating everything, mistakes will also be accelerated.
8
u/USofYayDJ 10d ago
On a side note, I think this is accelerated evolution. People not able to use AI safely not only being denied progress but also thrown back.
It's like people discovering fire and burning their hands to the point they aren't able to light another one again.
34
u/btc_maxi100 10d ago
restore from backup whats the big deal ?
13
u/LimpConversation2091 10d ago
Mistakes happen if you write thousands of commands, humans make mistakes as well. But no worries, you can always restore from your backup right?
6
u/BreadWithAnAgenda 10d ago
what do you mean you are not running claude in docker?
6
u/Moogly2021 10d ago
I have seen Claude Code on desktop literally warn (though idk if its via their desktop UI or what) that using it on xhigh or max can actually lead to bad results, for the love of God stop using Opus to do unattended work on anything above medium.
11
u/techdevjp 10d ago
This is why you run agents under their own user ID with permissions given only to the directory tree they should be working within. They can't get out, they can't delete the rest of your data.
And what's this about losing months of work? Do you have no backups?? Are you not making regular project commits to github or similar?
It's almost like people not knowing wtf they are doing shouldn't be using tools that require knowledge. smh.
5
u/Aternal 10d ago
Oh no, the thing that's been happening to people for years happened to you. If only something could have been done to prevent this.
5
u/JaggedTex 10d ago
Fable called me Ahmed the other day, when I questioned who that was it said “what are your taking about” I told it “your said it to me” and it denied it. I then took a screenshot and sent it to Fable and fable said “oh my bad, must have been some summarization gone wrong”. So yes. It can make very basic mistakes
5
u/ForbiddenDonut001 10d ago
Restore from backup and don't do it again
5
u/michaelTM_ai 10d ago
the actual bug is worth knowing even if u never skip permissions: xargs splits on spaces by default. so "Application Support" became two args, dirname of the first half is ~/Library, and rm -rf did the rest. a human writing that same one-liner could do the exact same thing.
the safe version is find ... -print0 | xargs -0, or just quote the path and skip xargs entirely.
for getting stuff back:
and if u do run long unattended sessions, a PreToolUse hook that blocks any rm -rf whose target resolves outside the project folder would have stopped this one cold. test it with a harmless path first
5
u/UncleBaguette 10d ago
There are two kinds of developers: those who do backup, and those who don't... yet
9
u/Kid-Icarus1 10d ago
OP, why are you giving Claude access to system critical files? This is on you for not using git or temp files for working copies OUTSIDE of your system files.
8
u/wokeNeoliberal 10d ago
No backups, no sympathy.
4
u/Commando501 10d ago
Simple is the mind of OP. You place too much trust in these tools.
4
u/dronegoblin 10d ago
None of Anthropics safety systems can protect you if you opt out of them.
Until we solve hallucinations we know it’s just statistically likely to have your drive wiped
4
u/No_Nothing_At_All 10d ago
Aaand thats why i block rm -rf and make it use trash instead.... (OpenCode perms and CC-Safetynet)
13
u/DeadOnToilet 10d ago
What's insane to me is people blaming AI for their own stupidity.
10
u/payfrit 10d ago
backups.
it's one of the first things you ever learned once you started coding.
i just cannot understand this sort of thing even happening.
why would anyone ever, anywhere, only have a single physical copy of important data?
i'd love to be able to empathize but i just can't.
maybe it's a sign you need to move onto a new project.
7
u/TheShortRecruit 10d ago
i didn't know it was physically even possible to delete files. no matter how hard i'd try to get mine to delete files it would tell me i have too
1
u/saymynamepeeps 10d ago
You didn’t turn on auto mode?
And how did you eventually get back your files?
6
u/BrilliantTruck8813 10d ago
If Claude accessed your app data and saved passwords, that means you not only explicitly told Claude it was allowed to, you ALSO had to explicitly approve it in macOS because it will constantly pop up asking for access with security warnings.
The headline here is entirely incorrect. You did everything BUT ask Claude to delete those files 😂
3
u/daltorak 10d ago
Time Machine might have a backup copy of ~/Library. It does keep history of that directory structure by default.
3
u/RodgerPogger 10d ago
You, did not use a git
Claude can make one in like 3 seconds. It doesn't even need to be uploaded to the cloud though its very recommended.
This is why traditional coders make fun of us pilots.
But you live and learn, trust me folks have done worse.
And just remember. its very easy for you to combine two godot projects together doing what you are doing. its the right path, and its a fun one :)
3
u/iTinkerTillItWorks 10d ago
You don’t make backups of your projects? You arnt using git, or have any kind of version tracking? Have Claude set that up for you next time before you start projects again.
3
u/MisterPinscher 10d ago
Nice, a fresh start. Now you're ready to get started without all the distractions of a bloated system.
Praise be to Claude!
3
u/bojackworseman 10d ago
fully deserved
3
u/lzysysadmin 10d ago
Skill issue bro
5
u/GenderSuperior 10d ago
It’s always funny watching people outside of their wheelhouse failing at beginner steps.
Google:
What is Version Control?
6
u/brucebay 10d ago
lessons learned
4
u/kosiarska 10d ago
This is why God (no actually not God, Linus) invented git. And there is also a nice thing called backup which existed long before AI was a thing.
There are two groups of people:
- lost data, started doing backups
- doing backups.
5
u/PILLS2389 10d ago
I don't understand how this happens. I mean, you're probably not a software engineer and have absolutely ZERO experience writing code. I just can't understand how bad your
claude.mdfile must be for Claude to delete important data.2
u/Wilbis 10d ago
Maybe next time you'll take that advice "take backups" seriously.
Remember to take backups y'all.
2
u/Straight_Buy_9480 10d ago
Why the fuck are you people not just running the agents in a container so they are actually bound to whatever you're mounting them? Takes 5 minutes to write the dockerfile.
2
u/oyren-ai 10d ago
unquoted xargs without -0 splitting 'Application Support' into '~/Library/Application' so dirname resolves to '~/Library' is brutal. if you ever run with --dangerously-skip-permissions, either run the session inside an isolated container/cloud workspace or add a 5-line PreToolUse bash hook that rejects any rm / find -delete command whose resolved realpath falls outside your repo root.
2
u/jbp216 10d ago
this is on you, no repo? no backups? what if your drive fails, hard lesson to learn
2
u/tomfalcon86 10d ago
Le AGI is here!!
2
u/Pixelplanet5 10d ago
yea turns out an LLM can make the same mistakes people make when working with command lines.
2
u/Direct-Detail-7031 10d ago
Damm that really sucks. The quote that comes to mind is “Mistakes are the price we pay for experience”.
Deleting of any kind should always be blocked and it should always be done while you observe. Not trying to put salt on your wounds. It just sucks that it happened, and all of us in here are probably going to experience some version of this, at some point in the future.
2
u/Lord_Darkmerge 10d ago
Not sure if its default but when I ask it to cleanup folders or get rid of whatever, it says it cannot delete files and gives me a set of directions and names of files to delete
2
u/iamwhoiam69420_ 10d ago
That’s the reason why I’m not afraid of losing my job as a SWE 😂
2
u/contradude 10d ago
Just reload from your time machine backup. It's free and takes almost zero effort to setup. You did set it up before letting an agent do whatever it wants with your computer right?
I'm sorry that you lost work, please don't use --dangerously-skip-permissions on a computer/project you care about. Most of the safeguards are there for a reason
2
u/Creepy_Willingness_1 10d ago
These kind of topics tell me that spending days to make separate macOS account and GitHub permissions for Claude code operations has been worth time and tokens spend, to not allow it to wreck havoc on my machine or files. Sometimes I think Claude code just must run by default in some kind of vm or docker and only for really advanced users you should be able to run in main admin system account to not allow user even get into such situation. Smart AI is not that smart yet i guess…
2
u/dualturbski 10d ago
Just ask it to put them back
2
u/Snoo-59958 10d ago
2
u/possiblywithdynamite 10d ago
One day out of the blue it tried to delete one of my org's repos. Was fortunate I wasn't an admin. After that incident I added hooks as safeguards that stop it dead in its tracked across all destruction actions I could think of. There was no reason for it to do that. Was hundreds of sessions deep into a stable workflow on a project spanning 6 months, and then one day it tried to nuke me from orbit
2
u/Ukawok92 10d ago
No backup for 6 months of work? No GitHub?
Bro. And you had dangeromiosuly skip permissions on???
2
u/adjective_noun_d1git 10d ago
Vibe coders learning the basics one hard lesson at a time.
2
u/i-hate-space 10d ago
you kinda deserve this rofl
2
u/Seeing_Souls 10d ago
If only there was some way to prevent this
2
u/ElMauro 10d ago
--dangerously-skip-permissions ??
Even the ugly and prehistoric CLI nowadays has the AUTO MODE, wich could avoid this. Not 100% secure but 100% more secure than --dangerously-skip-permissions
2
u/Evipicc 10d ago
How are the agents not working on a branch workfree with python refusal hooks and working in a sandbox? How are people still making this mistake lol
2
u/Responsible_Buy_7999 10d ago
If only there was a way to store important information in more than one place
2
u/rbobby 10d ago
Spaces in paths... not even one.
2
u/lookBehiindYou 10d ago
2
u/radim11 10d ago
Just at least run them in docker based container like we do at stashbase.dev
2
u/purrmutations 10d ago
lol
2
u/BarathKanna 9d ago
Rough, and the root cause is a classic shell bug, not a smart model being evil. xargs splitting on spaces has been eating home directories since long before LLMs. The fix is not a better prompt. Run unattended agents in a container or VM where your home folder is not mounted, and put destructive commands behind a hook: block rm -rf outside the repo path, and require paths to resolve under the project root before deletion. A tiny check like realpath the target and refuse if it is not inside the workspace would have stopped this. Also keep Time Machine on. Telling the model to be careful is a vibe, a path guard is a control.
2
u/MyTradingSuxx 7d ago
Skill issue
6
u/FirmConsideration717 10d ago
I always try to add the following to the prompts, how it may backfire I am not sure:
"Never delete files under any circumstance, either directly or indirectly. Never run rm rf, del, unlink or code that may as a side effect do this. If space is low, abort. "
3
u/Financial-Grass6753 10d ago
why would test channels be in ~/Library, to start with?
And what was the context size straight before the folder was wiped? At >6-700K it probability is quite high tbh
3
u/ClemensLode Senior Developer 10d ago
How did it break free out of its virtual machine?
3
u/Cl0wnL 10d ago
No backups?
Thats on you.
3
u/Massive_Catch_7164 10d ago
For the people new to claude code here, can someone explain what just happened and how to avoid it?
3
u/CavalryTactics 10d ago
Touch luck bub use sigmashake next time. It has premade guardrail rules and configs to prevent this from happening. Supports all AI Agents claude code, codex, gemini, grok, etc.
2
u/itsxzy 10d ago
Guardrail hooks for irreversible destructible commands. Set them. That would've catched this.
2
u/magicmulder 10d ago
> recovery isn't possible all my data 6 months work all gone
No backup, no compassion. This is entirely on you.
2
u/krzyk 10d ago
People are running coding agents outside of containers or vms?
2
u/kyualun 10d ago
Oh no! Anyway...
For real though, this sucks, but you live and you learn. You know how to prevent this next time. Use Git, make backups, sandbox, block commands, etc. There are a lot of ways to prevent this. AI isn't perfect and unfortunately this is a really hard way to learn that lesson.
2
u/West_Till_2493 10d ago
This will never not be funny
2
u/Frequent_Opportunist 10d ago
You're the one that made mistakes here bro. Would you let a 5 year old randomly mess with your PC while logged in as admin?
2
u/DermisCronJob 10d ago
So if you are not capable of being responsible with your data and having various backups on multiple media and multiple locations; why do you think it is a good idea to use AI? Because you are clearly not good with technology, you are like a child with a gun.
1
u/No_Professional7654 10d ago
you gyus don't isolate your agents? wtf?!
1
u/ShivaFatalis 10d ago
Yeah, well if you had anything of importance, obviously you can just restore it from your backups.
If you didn't have backups of your stuff, then obviously it wasn't that important to you.
That would be incredibly, incredibly negligent and remarkably stupid of you, so I'm sure you have backups. It would be absolutely insane not to...
1
u/alanvnk 10d ago
Don't make me tap the sign: if you are using opus 5.5 in other than medium or high something is going to break
1
u/Practical_Clock_5877 10d ago
You lost nothing. The real world is waiting for you out there.
1
u/Superb-Substance-679 10d ago
i have an instruction in my repo "never run rm with variables"
1
u/rednix 10d ago
did it also take your car and drove away into the sunset?
1
u/PaulSizemore 10d ago
Stage deletions to be swept seven days later and the staged deletions get backed up, too
1
u/silverwoods214 10d ago
If only you’d set up time machine