`--resume` picker crashes on corrupt sessions (ZstdDecompressionError), cascading to session index data loss

Resolved 💬 5 comments Opened Feb 7, 2026 by belumume Closed Mar 11, 2026

Environment: Windows 11, MSYS2 Git Bash, Claude Code v2.1.34–v2.1.37

Bug

When claude --resume scans sessions for the picker, it encounters sessions with embedded binary/compressed data and throws ZstdDecompressionError, causing an immediate exit. This crash can leave sessions-index.json in a partially-written state, causing subsequent launches to show dramatically fewer sessions.

Reproduction

  1. Have multiple sessions in a project directory, some of which crashed mid-write (common on Windows due to #22970 TUI instability)
  2. Run claude --resume
  3. Picker begins loading → hits a corrupt .jsonl file with embedded binary data → ZstdDecompressionError → Claude exits immediately
  4. Run claude --resume again → session count is now much lower (e.g., 146 → 22 → 10)

Root cause

Some .jsonl session files contain embedded binary/null bytes (likely from crashes during context compression). When the --resume picker tries to deserialize these, zstd decompression fails. The crash during index scanning leaves sessions-index.json truncated.

Impact

  • --resume becomes unreliable — exits before showing the picker
  • Session index loses entries on each crash (fluctuating session counts)
  • Recent sessions "disappear" from the picker despite .jsonl files being intact on disk
  • Users lose the ability to discover and resume their sessions

Workaround

Identified and quarantined 14 corrupt session files (containing \x00 or replacement characters) by removing them from sessions-index.json. This stopped the crashes and stabilized the index.

Suggested fix

The --resume picker should catch ZstdDecompressionError per-session rather than crashing entirely. Corrupt sessions should be skipped (or flagged) instead of terminating the picker. The index write should also be atomic (write to temp file, then rename) to prevent truncation on crash.

View original on GitHub ↗

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