[BUG] Multiple .claude.json.backup files spawned on startup without cleanup

Status Fixed / completed
Reported on v2.1.22
Maintainer reply ✓ Yes — ashwin-ant
Activity 13 comments · opened Jan 28, 2026 · closed Feb 13, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

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?

  1. At most ONE backup file should be maintained (not multiple timestamped versions)
  2. Old backup files should be cleaned up automatically
  3. 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

  1. Run rm ~/.claude.json.backup.* to clean up existing backups
  2. Start Claude Code (claude)
  3. Check home directory: ls -la ~/.claude.json*
  4. 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.

View original on GitHub ↗

13 Comments

nicholas-moger · 7 months ago

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" />

lachiewalker · 7 months ago

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

rodaguilera · 7 months ago

Confirming on macOS (Darwin 25.2.0) — seeing 5+ backup files created within the same minute on every startup.

tr1s · 7 months ago

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" />

nikita-rr · 7 months ago

+1, after reinstall
<img width="330" height="205" alt="Image" src="https://github.com/user-attachments/assets/fcae92f3-06ea-464f-86c2-43a7a923b29b" />

LazyYuuki · 7 months ago

<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/

thaddox · 6 months ago

Happening on Windows as well. Native winget install. 2.1.29

nikhilsitaram · 6 months ago

Same issue here.

jwnome · 6 months ago

Same thing here.

jaeheonji · 6 months ago

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 the XDG_HOME_DIR without any organization.

To avoid this, I set a specific directory using the CLAUDE_CONFIG_PATH environment 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 fish shell, and I have added the following configuration to my config.fish file:

set -gx CLAUDE_CONFIG_PATH $HOME/.config/claude

<img width="491" height="191" alt="Image" src="https://github.com/user-attachments/assets/3b72e81f-a255-4a65-bbb3-c9ad8829d6ef" />

ataraxia937 · 6 months ago

I decided to work around this with a cron job to delete the backup files every hour.

ashwin-ant collaborator · 6 months ago

Will be fixed in the next release

github-actions[bot] · 6 months ago

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.