Dev Tools · 1h ago
Fix for Claude Code session bricked by orphaned UTF-16 surrogate in transcript
A lone UTF-16 surrogate in a Claude Code session's JSONL transcript causes a permanent API error on every turn. The fix strips only the orphaned surrogate code points (U+D800–U+DFFF) from the offending line, leaving emoji intact. A byte-level pre-filter reduced scan time from 3.4s to 1.1s across 174 files.
Meridian48 take
The workaround is clever but highlights a brittleness in how AI tools handle non-BMP characters and truncation — a fix that should arguably be upstream in the API or client.
Read the full reporting
"Claude Code '400: no low surrogate in string' on every turn: repairing a permanently broken session transcript" →
DEV Community
claude-codeutf-16-bug