claude-code - 💡(How to fix) Fix [BUG] .claude.json and backup files disappearing without user action — twice in 48 hours [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#53116Fetched 2026-04-25 06:11:56
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

On two occasions within 48 hours (April 23–24, 2026), the file C:\Users\teres.claude.claude.json disappeared, causing complete loss of session context. No user action caused the deletions.

Additionally, a specific backup file (C:\Users\teres.claude\backups.claude.json.backup.1777050649898, timestamped April 23) was visible in the backups folder, was not deleted by the user, and disappeared within minutes of being identified — before it could be used to restore the session.

The pruning explanation doesn't hold: older backup files (dating to April 7) remain untouched while a recent file was deleted. This is inconsistent with any age-based pruning logic.

Environment:

  • Windows 11 Pro 10.0.26200
  • Claude Code version: 2.1.119
  • No antivirus, sync tools (OneDrive/Dropbox), or backup software active on the affected directory

Impact: Each deletion requires manual context reconstruction from CLAUDE.md, causing significant disruption to active research work.

Request: Investigate what process is deleting these files and add protection against unintended deletion of .claude.json and its backups.

What Should Happen?

.claude.json should not disappear and, if it does, the backup file should not suddenly disappear. See "Impact" above.

Error Messages/Logs

Steps to Reproduce

  1. work with Claude code.
  2. finish for the day, type /exit
  3. type claude --continue
  4. no session history! Look for .claude.json but non-existent
  5. find history file, try to copy to .claude.json, history file disappears.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

Claude Sonnet 4.6 has been behaving oddly for about 5 days.

Claude Code Version

Claude code v2.1.120

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

<img width="1614" height="173" alt="Image" src="https://github.com/user-attachments/assets/23a3ebbe-849d-4702-89e3-3b3c6d2fb6cc" />

extent analysis

TL;DR

Investigate and potentially modify the file deletion logic in Claude Code to prevent unintended removal of .claude.json and its backups.

Guidance

  • Review the Claude Code version history to identify changes in file management between version 2.1.119 and the previous working version, focusing on any updates to backup and pruning logic.
  • Inspect system and application logs for any error messages or warnings related to file access or deletion around the time of the incidents.
  • Consider implementing additional logging or auditing in the Claude Code application to track file system interactions, especially for the .claude.json file and its backups.
  • Evaluate the possibility of external factors, such as system maintenance tasks or third-party applications, that could be interacting with the .claude directory, despite the user's assertion that no such software is active.

Example

No specific code example can be provided without more details on the internal workings of Claude Code. However, a general approach to auditing file system changes in a similar application might involve logging file access and modification events.

Notes

The investigation is complicated by the lack of explicit error messages or logs detailing the file deletions. The presence of older backup files suggests that any pruning logic based on file age may not be the cause, pointing towards a more specific issue with the application's handling of recent files.

Recommendation

Apply a workaround by manually backing up the .claude.json file to a separate, protected location until the root cause can be identified and addressed, as the current version of Claude Code (v2.1.120) is suspected to have a regression causing this issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING