[BUG] Session silently missing from Desktop sidebar when its .jsonl contains NUL-byte blocks after a system crash
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
\x00padding - 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)
- Take any valid session
.jsonlin~/.claude/projects/<project>/ - Append a line of NUL bytes (e.g. 1KB of
\x00) to simulate a crash-truncated write - Restart the Desktop app → the session no longer appears in the sidebar/session list, with no error shown
🤖 Generated with Claude Code
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗