[BUG] Panic when handling Japanese UTF-8 strings - invalid byte boundary slice
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude Code crashes with a panic when processing Japanese text.
Error message:
thread '<unnamed>' (3848961) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 17 is not a char boundary; it is inside 'ル' (bytes 15..18) 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
Environment:
- OS: macOS (Darwin 25.2.0)
- Shell: zsh
- 2.0.76 (Claude Code)
Root cause:
The code appears to be slicing a UTF-8 string at a byte index that falls in the middle of a multi-byte character (Japanese ル occupies bytes 15-18, but slice attempted at byte 17).
Expected behavior:
Claude Code should correctly handle multi-byte UTF-8 characters and only slice at valid character boundaries.
What Should Happen?
Claude Code should correctly handle multi-byte UTF-8 characters (such as Japanese, Chinese, Korean, emoji, etc.) without crashing. When truncating or displaying strings, it should slice at valid character boundaries, not in the middle of multi-byte characters.
Error Messages/Logs
>
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
? for shortcuts
thread '<unnamed>' (3848961) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 17 is not a char boundary; it is inside 'ル' (bytes 15..18) 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
Steps to Reproduce
- Open Claude Code in a project containing Japanese text in source files
- Ask Claude to edit a TypeScript/React file (e.g., AdminWindow.tsx)
- While Claude is processing/thinking ("Noodling…" or "Clauding…" phase),
the application crashes with UTF-8 panic
Context: The project appears to contain Japanese game-related text
including コントロール(シンクロ) (Control/Synchro) in the codebase.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗