[BUG] Session transcripts silently auto-deleted after 30 days; sidebar shows ghost entries that error on click

Resolved 💬 2 comments Opened May 28, 2026 by ashpat00 Closed Jun 29, 2026

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?

Environment
• Claude Code: 2.1.149
• Claude Desktop on Windows 11 Pro
• Entrypoint: claude-desktop
Summary
The default cleanupPeriodDays: 30 silently deletes session transcript JSONL files with no notification, no opt-in, and no exposure in the desktop UI. The sidebar continues to advertise those sessions because the cleanup leaves their metadata records behind. Clicking any of them shows "session not found on disk." Of my 38 sidebar entries, 26 are broken and the conversation content is unrecoverable — months of work on a real product, gone with no warning.

What Should Happen?

I should be able to continue in the session where I left off.

Error Messages/Logs

Steps to Reproduce

Reproduction (visible to user)

  1. Use Claude Code Desktop normally for 30+ days.
  2. Click a session in the sidebar dated more than ~30 days ago.
  3. Error: "session not found on disk."
  4. There is no UI affordance to recover, explain, or clean up the broken entry.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.149

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

Root cause (from investigation of the local files)
Two stacked problems:

  1. Silent cleanup with orphaned sidebar metadata. cleanupPeriodDays (default 30, per strings in claude.exe) deletes JSONL transcripts at ~/.claude/projects/<encoded-cwd>/<sessionId>.jsonl based on file age, but does NOT remove the corresponding sidebar metadata file at ~/AppData/Roaming/Claude/claude-code-sessions/.../<id>.json. The sidebar therefore lists sessions whose transcripts no longer exist. ~/.claude/.last-cleanup confirms cleanup ran today.
  2. Schema-upgrade gap in older metadata. Sidebar metadata was extended at some point with a cliSessionId field that points to the transcript filename. Records created before that change were never backfilled, so even if the transcript still existed on disk, the desktop app has no way to map the sidebar entry to it.

The boundary lines up exactly with a 30-day retention window. There was no Recycle Bin entry, no Windows File History (not enabled by default), no OneDrive backup (AppData isn't synced by default), and no other backup — so the deletion is final.

Why this is a UX failure, not just a bug
"Cleanup" should not mean "delete the user's work history without telling them." There's a real difference between housekeeping (caches, stale locks, process state) and chat/code session transcripts. The current product collapses both under one buried config key. A user who never reads the binary's embedded help has no way to know any of this is happening.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗