Panic when truncating Korean (UTF-8 multibyte) strings - byte index is not a char boundary

Resolved 💬 3 comments Opened Jan 7, 2026 by piljung89 Closed Jan 7, 2026

Description

Claude Code crashes with a Rust panic when processing Korean text. The error occurs when the application attempts to truncate a UTF-8 string at a byte index that falls inside a multibyte character.

Error Message

thread '<unnamed>' (67623043) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 22 is not a char boundary; it is inside ' 를' (bytes 20..23) of `널 또는 라이브를 찾을 수 없습니다`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1]    66253 abort      claude

Analysis

  • The string 널 또는 라이브를 찾을 수 없습니다 appears to be truncated from 채널 또는 라이브를 찾을 수 없습니다 (meaning "Channel or live not found" in Korean)
  • Korean characters are 3 bytes each in UTF-8
  • The code is attempting to slice the string at byte index 22, which falls in the middle of the character (bytes 20-23)
  • This suggests the truncation logic is using byte offsets instead of character boundaries

Environment

  • OS: macOS (Darwin 24.6.0)
  • Claude Code version: latest

Expected Behavior

String truncation should respect UTF-8 character boundaries, especially for multibyte characters like Korean, Chinese, Japanese, emoji, etc.

Suggested Fix

Use character-aware string slicing methods instead of byte-based indexing. In Rust, this can be done using .char_indices() or libraries like unicode-segmentation.

View original on GitHub ↗

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