[BUG] Session silently missing from Desktop sidebar when its .jsonl contains NUL-byte blocks after a system crash

Open 💬 1 comment Opened Jul 9, 2026 by ChavdaViral

Environment

  • Claude Code Desktop v2.1.202, Windows 10 Pro 10.0.19045
  • Entrypoint: claude-desktop

Summary

After a hard system crash mid-conversation, the active session's .jsonl transcript in ~/.claude/projects/<project>/ was left with zero-filled (NUL-byte) blocks — the classic NTFS crash artifact where the file was extended but data pages were never flushed. The Desktop app then silently omits the session from the sidebar (and from session-listing/search tooling) instead of surfacing it as recoverable. To the user this looks like data loss, even though ~99% of the transcript is intact on disk.

Observed file state (real example)

Transcript had 128 lines; two were corrupt:

  • One mid-file line: a valid 159-byte JSON record followed by ~9KB of \x00 padding
  • The final line: ~143KB of pure \x00 (crash happened during this append)

All other 126 lines were valid JSON.

Expected behavior

  • Robust parsing: skip/ignore unparseable lines (or trailing NUL blocks) and still list the session, ideally with a "recovered" indicator — rather than dropping the whole session from the UI with no warning.
  • Crash-safe appends (e.g. fsync strategy or a repair pass on startup) so a power loss/crash doesn't leave NUL blocks that poison the file.

Workaround that confirmed the diagnosis

Stripping \x00 bytes and dropping the resulting empty lines restored a fully valid file; every remaining line parses and the parent-uuid chain is consistent. The session data was never lost — only hidden.

Steps to reproduce (synthetic)

  1. Take any valid session .jsonl in ~/.claude/projects/<project>/
  2. Append a line of NUL bytes (e.g. 1KB of \x00) to simulate a crash-truncated write
  3. Restart the Desktop app → the session no longer appears in the sidebar/session list, with no error shown

🤖 Generated with Claude Code

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗