[BUG] Claude CLI did delete my ~/.claude.json file
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?
Hello,
after adding an MCP server to ~/.claude.json, most probably using a wrong syntax, i got the following output after starting claude:
<code>
Configuration Error │
│ │
│ The configuration file at /home/av/.claude.json contains invalid │
│ JSON. │
│ │
│ JSON Parse error: Unable to parse JSON string │
│ │
│ Choose an option: │
│ ❯ 1. Exit and fix manually │
│ 2. Reset with default configuration
</code>
I used option one and when opening the .claude.json file it had been reduced to this:
<code>
{
"cachedStatsigGates": {
"tengu_prompt_suggestion": true
},
"cachedGrowthBookFeatures": {
"tengu_sumi": true,
"tengu_1p_event_batch_config": {
"scheduledDelayMillis": 5000,
"maxExportBatchSize": 200,
"maxQueueSize": 8192
},
"tengu_mcp_tool_search": false,
"tengu_scratch": false
},
"userID": "NotAnUser-ID",
"firstStartTime": "2026-01-16T10:02:05.815Z",
"sonnet45MigrationComplete": true,
"opus45MigrationComplete": true,
"opusProMigrationComplete": true,
"thinkingMigrationComplete": true
</code>
.claude.json.backup also had been corrupted....
What Should Happen?
The ".claude.json" file should not be touched in case of an syntax / parse error or the current content should be saved to a different file like ".claude.json.parse-error"
Error Messages/Logs
Steps to Reproduce
- edit .claude.json and corrupt the json syntax somehow
- start claude CLI / code
- Choose option 1 "Exit and fix manually"
- Check .claude.json and find it truncated to a handfull of lines
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.9 (Claude Code)
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗