[BUG] Multiple .claude.json.backup files spawned on startup without cleanup
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?
Claude Code creates multiple .claude.json.backup.{timestamp} files in the home directory on startup, but never cleans them up. These accumulate indefinitely, cluttering the home directory.
The backups are created within milliseconds of each other (sometimes 2-3 files within the same second), suggesting multiple redundant backup operations are being triggered during initialization.
$ ls -la ~/.claude.json*
-rw-r--r--@ 1 user staff 51205 28 Jan 21:35 /Users/user/.claude.json
-rw-r--r--@ 1 user staff 51205 28 Jan 21:35 /Users/user/.claude.json.backup.1769596532941
-rw-r--r--@ 1 user staff 51205 28 Jan 21:35 /Users/user/.claude.json.backup.1769596532943
Deleting these files only temporarily solves the problem - they are immediately recreated when Claude Code loads.
What Should Happen?
- At most ONE backup file should be maintained (not multiple timestamped versions)
- Old backup files should be cleaned up automatically
- Multiple backup operations should not fire within milliseconds of each other during startup
Error Messages/Logs
No error messages - files are silently created and accumulate.
Steps to Reproduce
- Run
rm ~/.claude.json.backup.*to clean up existing backups - Start Claude Code (
claude) - Check home directory:
ls -la ~/.claude.json* - Observe multiple new
.claude.json.backup.{timestamp}files have been created
Claude Model
Any
Is this a regression?
Unknown
Last Working Version
_No response_
Claude Code Version
2.1.22 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
zsh
Additional Information
Related issues:
- #14634 - Excessive File I/O (same underlying issue of redundant writes)
- #20637 - Race condition with multiple VS Code windows writing to ~/.claude.json
- #11963 - Feature request for auto-cleanup of temporary files
All backup files have identical size (51205 bytes), suggesting they're identical copies being created redundantly.
13 Comments
Can confirm - same behaviour on Ubuntu server
<img width="1124" height="98" alt="Image" src="https://github.com/user-attachments/assets/c694808c-25a4-48b1-a408-d69c17d3e6ce" />
I have also observed (and been annoyed by) this on Ubuntu 24.04 LTS in bash with Claude 2.1.23
I get 5 backup files every time claude is launched
Confirming on macOS (Darwin 25.2.0) — seeing 5+ backup files created within the same minute on every startup.
Same here. Just transferred computers and fresh installed. Thought I might have messed up the install, but just seems to be a fresh bug.
I delete them and they come right back.
<img width="1080" height="288" alt="Image" src="https://github.com/user-attachments/assets/09bc7423-166d-42aa-ba74-9dce8e628a0a" />
+1, after reinstall
<img width="330" height="205" alt="Image" src="https://github.com/user-attachments/assets/fcae92f3-06ea-464f-86c2-43a7a923b29b" />
<img width="405" height="175" alt="Image" src="https://github.com/user-attachments/assets/8f106985-a85a-4ca6-b4f8-083301260c11" />
Having the same issue over here
Why don't Claude Code follow the convention to store things in
.claude/or.config/claude/Happening on Windows as well. Native winget install. 2.1.29
Same issue here.
Same thing here.
I'm experiencing the same issue where multiple backup files are being generated. Even after deleting them, exactly five backup files are recreated every time.
By default, if no configurations are set, all files—such as
.claude/,.claude.json, and.claude.json.backup.xxxx—are generated in theXDG_HOME_DIRwithout any organization.To avoid this, I set a specific directory using the
CLAUDE_CONFIG_PATHenvironment variable. While this ensures all files are created within that specific path, the issue of multiple backup files being generated persists.---
For reference, I'm using the
fishshell, and I have added the following configuration to myconfig.fishfile:<img width="491" height="191" alt="Image" src="https://github.com/user-attachments/assets/3b72e81f-a255-4a65-bbb3-c9ad8829d6ef" />
I decided to work around this with a cron job to delete the backup files every hour.
Will be fixed in the next release
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.