Panic: UTF-8 byte boundary error when processing Japanese text
Resolved 💬 1 comment Opened Jan 1, 2026 by Yamato-S0 Closed Jan 1, 2026
Bug Description
Claude Code crashes with a Rust panic when processing files containing Japanese text.
Error Message
thread '<unnamed>' panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 24 is not a char boundary; it is inside 'す' (bytes 22..25) of `下の3段階で定義する`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1] 3413453 IOT instruction (core dumped) claude
Root Cause
The code is attempting to slice a UTF-8 string at a byte index (24) that falls in the middle of a multi-byte character ('す', which occupies bytes 22-25). In Rust, string slicing at non-character boundaries causes a panic.
Steps to Reproduce
- Open a file containing Japanese text in the IDE (the file was
docs/research_plan/05_definitions.md) - The file contains the text
下の3段階で定義する - Claude Code crashes when processing this file
Environment
- Platform: Linux 6.1.0-25-amd64
- Claude Code version: (latest as of 2026-01-01)
Expected Behavior
Claude Code should correctly handle multi-byte UTF-8 characters (Japanese, Chinese, Korean, emoji, etc.) without crashing.
Suggested Fix
Ensure all string slicing operations use character boundaries (.char_indices()) rather than raw byte indices, or use safe slicing methods that account for UTF-8 encoding.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗