Desktop app OOM crash on large .jsonl transcripts — /stats scanner has no per-file size limit
What happened
Claude Code desktop app crashes at startup with a V8 heap-out-of-memory abort when any .jsonl transcript in ~/.claude/projects/** grows past ~1 GB. Root cause: the /stats scanner reads every transcript synchronously into V8's ~4 GB heap with no per-file size limit.
Long-running sessions accumulate context across every close-out and the .jsonl grows indefinitely. A governance session on my machine reached 1,418,037,042 bytes (1.42 GB) before crashing; a parallel session reached 947,151,855 bytes (947 MB). Together they exhausted the heap before the sidebar could render.
Log signatures
[CCD] /stats scanning N/M transcript files since <date>immediately before crashOOM error in V8: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memoryzsh: trace trapon the launching shell- No
DiagnosticReport.appentry — the crash is silent to anyone not watching the launching terminal
Secondary observation (likely amplifier)
On the IndexedDB retry path after the initial failure I saw:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 change listeners added to [RAr]
11 change listeners added to [Cookies]
Event listeners appear to leak on the retry path. This accelerates heap climb beyond what the scan alone would produce.
Recovery (required manual intervention)
- Move oversized
.jsonlfiles out of~/.claude/projects/(I quarantined to~/claude-oversized-transcripts.bak/). The files themselves are preserved but can no longer be opened in the app — reopening would re-trigger the OOM. - Wipe IndexedDB to clear corrupted sidebar state.
- Restart.
Requested fixes
/statsscanner: stream files, skip files above a size threshold, or alert on oversized transcripts — don't OOM the whole app.- Listener leak on the IndexedDB retry path.
- Surface OOM crashes with a
DiagnosticReportentry so users know what happened rather than facing an app that silently won't open.
Environment
- Claude Desktop: 1.3109.0
- Claude Agent SDK: 0.2.111
- OS: macOS (Darwin 25.2.0)
Happy to provide the full OOM trace or additional details if useful. Long-running governance sessions are the most exposed — context accumulates across close-outs and the .jsonl grows indefinitely with no built-in rollover mechanism.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗