[BUG] `.claude.json` is trucated directly, and so occasionally gets corrupted
Status Closed — not planned
Maintainer reply None cached
Activity 15 comments · opened Jun 25, 2025 · closed Jan 4, 2026
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: <!-- output of
claude --version--> 1.0.35 - Operating System: <!-- e.g. macOS 14.3, Windows 11, Ubuntu 22.04 --> macOS
- Terminal: <!-- e.g. iTerm2, Terminal App --> Alacritty
Bug Description
I occasionally get my .claude.json wiped. I _think_ that's happening because claude truncates it directly when writing an edit. and so if one process hasn't completed writing when another attempts to read, it'll get a corrupted file, and then wipes the whole thing
this becomes really evident when mounting it as a file to a container; if lots of claudes are running, and .claude.json is large, the container is fairly likely to get less than a full file given docker's mount performance
Expected Behavior
have claude do an atomic rename of .claude.json
15 Comments
is this why mine is full of 'pasted comments' ?
!Image
it eventually becomes unusable.
yeah this happens to me multiple times a day during regular usage (working on 2-3 code bases)
it's sort of upsetting that a conversation history/state is stored here where my settings and mcps are also configured....
No update?
ive not seen it happen again but ive also not let claude touch the file except for the single terminal prompt command for injecting a new mcp server. ie, i never ask it to do anything to the file.
Same here. I tried setting up a claude slash command that uses the !
commandsyntax to run a script to fetch and summarize all my todo comments in parallel before handing over to the interactive instance, but running it once corrupts the.claude.jsonfile multiple times...which isn't just annoying because it kills my settings, it's annoying because it clutters up the summary with more
Claude configuration file at /home/liu/.claude.json is corruptederrors than actual summaries.I don't even need atomic writes, just a flag to run non-interactive claude (claude -p) without permission to edit the
.claude.jsonfileNot sure if there's a new bug with this, but for me it just started this week.
For what it's worth, the files I spot checked were all valid JSON according to
jq.i ended up deleting a pile of files like that, not sure maybe from claude crashing?
me too. they appeared for me on reboot when i guess i restarted my computer without closing every claude code session gracefully.
i dont really care that much about losing like the prompt history. maybe being able to set mcps in settings would make it okay? https://docs.anthropic.com/en/docs/claude-code/settings#settings-files
Whenever I have Claude Code doing something heavy, it can eat A LOT of disk space. Running out of disk space is one reason that causes an immediate panic & results in .claude.json being wiped. The next time you start Claude it complains that it's corrupt and wants you to setup from scratch again.
definitely not that - I ran into this issue on a 2tb partition that was maybe 10% full
.. I'm pretty sure it's parallel claude code instances - but it might've been fixed, because I haven't run into it since tbh - might try to reproduce on monday
i think what was causing it for me is that i would kill every claude code instance at once with a
killallcommand after being done working in parallel between 3-4 sessions, and them all trying to save at once broke things, but this also hasnt happened to me in a while so maybe its fixed and we can all rejoyceUsed claude code to clear it. By asking to clean the file because it was too large.
Still don't know what causes it
This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.
This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.