[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.
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗