Panic when displaying Korean (UTF-8 multibyte) characters in statusline
Bug Description
Claude Code CLI panics when displaying status messages containing Korean (or other UTF-8 multibyte) characters in the statusline. The panic occurs because the code attempts to slice a string at a byte index that is not a character boundary.
Error Message
thread '<unnamed>' (11092) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:
byte index 5 is not a char boundary; it is inside '형' (bytes 3..6) of `문형) - 캐싱된 generator 사용`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Root Cause
The statusline truncation logic appears to use byte indices rather than character indices when truncating strings. Korean characters (like '형') are 3 bytes in UTF-8, so slicing at byte index 5 falls in the middle of a character.
Environment
- OS: Windows 10/11
- Language/Locale: Korean
Expected Behavior
The statusline should properly handle UTF-8 multibyte characters by truncating at character boundaries, not byte boundaries.
Suggested Fix
Use character-aware string slicing methods like .chars().take(n) or .char_indices() instead of byte-based slicing when truncating strings for display.
Workaround
Disabling the statusline with claude config set --global statusline disabled prevents this panic.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗