Skip to content

[BUG] CLI silently deletes session .jsonl files created on v2.1.37–v2.1.39 during later auto-updates #36272

Closed as not planned

Description

@adamfeldman

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?

Session .jsonl files created by CLI versions 2.1.37–2.1.39 have been silently deleted from ~/.claude/projects/. The subagent directories (<sessionId>/subagents/) survived — only the parent conversation files were removed. These sessions are invisible to /resume and unrecoverable without a filesystem backup.

This is not the Desktop migration issue (#29373) or the index staleness issue (#24729) — the actual conversation data files were deleted from disk.

What Should Happen?

  1. Session data files should never be silently deleted
  2. If a storage format migration occurs, old files should be preserved or migrated — not removed
  3. At minimum, a warning/log should be emitted before any session cleanup

Error Messages/Logs

Steps to Reproduce

  1. Have sessions created on CLI v2.1.37–v2.1.39
  2. Auto-update through v2.1.40–v2.1.56+
  3. Run /resume — old sessions are gone
  4. Check ~/.claude/projects/<project>/ — subagent directories exist but .jsonl files are missing

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.39 (sessions were actively used and resumable at that version)

Claude Code Version

2.1.79 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Cursor

Additional Information

Evidence

Version-correlated pattern across 4 independent projects:

Session version .jsonl present? Subagent dir present? Count
v2.1.37–v2.1.39 No (deleted) Yes (orphaned) 101 sessions
v2.1.56+ Yes Yes All intact
v2.1.40–v2.1.55 No sessions exist on this machine to test — —

Confirmed via backup: A backup of ~/.claude/ from Feb 24 contains all 70 .jsonl files for one affected project. On the live filesystem (March 19), only 2 .jsonl files remain — both from today's sessions. The files existed and were deleted sometime between Feb 24 and March 19 as the CLI auto-updated through the v2.1.40–v2.1.56 range.

Recovery: Copying the .jsonl files from the backup restores all sessions. They load and display correctly in v2.1.79 via /resume.

Suspected Cause

Something in the v2.1.40–v2.1.55 range appears to have treated .jsonl files without corresponding session index entries as garbage and cleaned them up. This aligns with the v2.1.30 changelog ("replacing the session index with lightweight stat-based loading") — the transition from index-based to stat-based session discovery may have included cleanup logic that removed files not tracked by the old index.

The subagent directories survived because they live in a subdirectory structure that the cleanup logic didn't target.

Related Issues

Activity

  1. github-actions commented on Apr 16, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  2. github-actions commented on Apr 25, 2026

    @github-actions

    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.

  3. locked as resolved and limited conversation to collaborators on Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corebugSomething isn't workingdata-losshas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions