[Bug] Panic on UTF-8 multibyte character boundary in Japanese text
Resolved 💬 14 comments Opened Dec 18, 2025 by Kubbo0308 Closed Apr 18, 2026
Description
Claude Code CLI panics when processing Japanese text that contains multibyte characters. The panic occurs when the code attempts to slice a string at a byte index that falls in the middle of a multibyte UTF-8 character.
Error Message
thread '<unnamed>' (2356591) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 23 is not a char boundary; it is inside 'ィ' (bytes 21..24) of `情報セキュリティ`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1] 78853 abort claude
Analysis
The panic occurs because:
- Rust encodes strings in UTF-8
- The Japanese character 'ィ' spans 3 bytes (21-24)
- The code attempts to slice the string at byte index 23, which is in the middle of the character
- This causes an invalid slice operation and triggers a panic
Environment
- macOS Darwin 25.0.0
- Claude Code CLI (latest version)
Expected Behavior
The CLI should properly handle multibyte UTF-8 characters (Japanese, Chinese, emoji, etc.) and not crash when processing them.
Suggested Fix
Use character-aware string operations like char_indices() instead of direct byte indexing when slicing strings that may contain multibyte characters.
This issue has 14 comments on GitHub. Read the full discussion on GitHub ↗