Session corruption: highlight.js internals leak into session data on compaction crash

Resolved 💬 4 comments Opened Apr 13, 2026 by Defyzzz Closed May 28, 2026

Description

Sessions become corrupted and unrecoverable — the entire session content gets replaced with minified highlight.js language definitions (Perl, Mojolicious, MoonScript, N1QL, Nginx, Nim, PostgreSQL, etc.).

Steps to reproduce

  1. Work in a named session with moderate-to-large context (multiple tool calls, file reads/edits)
  2. Session crashes or compaction triggers
  3. Attempting to resume the session shows minified JS code instead of conversation history
  4. The session is permanently corrupted and cannot be resumed

Observed behavior

  • Session file (.jsonl) fills with highlight.js language definition code (syntax highlighting internals)
  • CLI crashes with stack trace pointing to /$bunfs/root/src/entrypoints/cli.js
  • Stack trace includes: F, zI9, render, w$, TA, QH, UH, Ei, fmH — all in cli.js
  • The bug is reproducible — happened on two separate named sessions within the same day
  • Both sessions had similar workload (file editing, tool usage, moderate context size)

Expected behavior

Session should either compact successfully or fail gracefully without corrupting the session file.

Environment

  • Claude Code version: 2.1.104
  • OS: macOS (Darwin 25.4.0)
  • Shell: zsh
  • Platform: Apple Silicon

Impact

  • All conversation context and history in affected sessions is permanently lost
  • Work has to be redone from scratch in a new session
  • No way to recover the corrupted session

Sample of corrupted content (first few chars)

=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp"...

This is clearly highlight.js language keyword arrays being written to the session file instead of actual conversation data.

View original on GitHub ↗

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