claude-code
claude-code copied to clipboard
Panic: UTF-8 byte boundary error when processing Chinese characters
Description
Claude Code CLI crashes with a Rust panic when processing output containing Chinese characters.
Error Message
thread '<unnamed>' (693199) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 8 is not a char boundary; it is inside '。' (bytes 6..9) of `康)。`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort claude --permission-mode dontAsk
Environment
- Claude Code Version: v2.0.76
- Model: claude-opus-4-5-20251101
- OS: macOS (Darwin 25.1.0)
- Shell: zsh
Steps to Reproduce
- Start Claude Code with
claude --permission-mode dontAsk - Ask Claude to perform a task that generates Chinese text output
- In my case, I was updating documentation files containing Chinese content
- The crash occurred while Claude was updating
docs/architecture.mdwith Chinese text
Root Cause Analysis
This appears to be a string slicing error in Rust where the code attempts to slice a UTF-8 string at byte index 8, which falls inside the multi-byte Chinese character 。 (Chinese period, occupying bytes 6-9).
The string fragment 康)。 suggests the crash happened while processing Chinese text containing:
康(3 bytes))(3 bytes)。(3 bytes)
Expected Behavior
Claude Code should properly handle UTF-8 multi-byte characters and only slice strings at valid character boundaries.
Workaround
Restart Claude Code and retry the operation. The issue may be intermittent.