You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] .claude.json is trucated directly, and so occasionally gets corrupted #2593
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
Reacted by kylesnowschwartz, pressdarling, Dmytro Prokhorov, Paulo Matos and Artur Havrylov
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 !command syntax 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.json file 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 corrupted errors 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.json file
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.
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'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 killall command 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 rejoyce
Used claude code to clear it. By asking to clean the file because it was too large.
Your .claude.json file is 101 MB and contains 90 projects, all of which are:
- Unnamed projects
- Have no timestamp information
- Appear to be empty or orphaned project entries
Safe Cleanup Strategy:
1. Create a backup of the current file
2. Remove all 90 unnamed/empty projects while preserving:
- All configuration settings (user ID, MCP servers, etc.)
- Any named projects (currently none found)
- All non-project data
3. Verify the cleaned file works correctly
4. Keep the backup for 30 days as a safety measure
Expected Results:
- File size reduction: From 101 MB to ~0.03 MB (99.9% reduction)
- No loss of important settings or active projects
- Claude Code will continue working normally
Steps I'll execute:
1. Create timestamped backup: .claude.json.backup-YYYYMMDD
2. Create cleaned version removing all unnamed/empty projects
3. Replace original file with cleaned version
4. Verify file integrity and Claude Code functionality
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.
Activity
jezweb commentedon Jun 27, 2025
is this why mine is full of 'pasted comments' ?
it eventually becomes unusable.
elee1766 commentedon Jun 27, 2025
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....
pipedexplumbing commentedon Jul 2, 2025
No update?
jezweb commentedon Jul 3, 2025
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.
Liu-Eroteme commentedon Jul 4, 2025
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.jsonfileabh commentedon Jul 7, 2025
Not 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.jezweb commentedon Jul 7, 2025
i ended up deleting a pile of files like that, not sure maybe from claude crashing?
elee1766 commentedon Jul 7, 2025
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
juburr commentedon Jul 17, 2025
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.
Liu-Eroteme commentedon Jul 25, 2025
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
elee1766 commentedon Jul 25, 2025
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 rejoycejezweb commentedon Aug 23, 2025
Used claude code to clear it. By asking to clean the file because it was too large.
Still don't know what causes it
github-actions commentedon Dec 4, 2025
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.
github-actions commentedon Jan 4, 2026
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.
github-actions commentedon Jan 11, 2026
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.