Crash on Korean character boundary: byte index is not a char boundary
Resolved 💬 3 comments Opened Dec 16, 2025 by jemulpoclub Closed Dec 20, 2025
Description
Claude Code crashes when processing Korean text due to incorrect byte boundary handling.
Error Message
thread '<unnamed>' (149351) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 9 is not a char boundary; it is inside '액' (bytes 7..10) of `상 금액`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
Aborted (core dumped)
Environment
- OS: Rocky Linux 9
- Platform: linux (5.14.0-605.el9.x86_64)
Analysis
The crash occurs when attempting to slice a Korean string at byte index 9, which falls in the middle of the multi-byte UTF-8 character '액' (bytes 7..10). The string 상 금액 contains:
- '상' (bytes 0-2)
- ' ' (byte 3)
- '금' (bytes 4-6)
- '액' (bytes 7-9)
This is a classic UTF-8 boundary issue where the code is using byte indices instead of character indices when slicing strings containing multi-byte characters.
Suggested Fix
Ensure all string slicing operations use character-aware boundaries, such as Rust's char_indices() or similar safe string slicing methods.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗