Rust panic on Korean (UTF-8 multibyte) text processing
Bug Description
Claude Code panics when processing Korean text in project files.
Version
- Claude Code: 2.0.76
- OS: Windows 11
Error Message
thread '<unnamed>' (40788) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:
byte index 6 is not a char boundary; it is inside '개' (bytes 4..7) of ` 402개, try/except 블록 113개가 있으며,`
Reproduction Steps
- Have a project with Korean text in markdown files (e.g., CLAUDE.md, docs/*.md)
- Run Claude Code in that project directory
- Panic occurs when Claude Code processes/truncates Korean strings
Root Cause Analysis
Rust code appears to be slicing a UTF-8 string by byte index instead of respecting char boundaries. Korean characters are 3 bytes each in UTF-8, so byte index 6 falls inside a multi-byte character (bytes 4-7).
The problematic code path is in core::str::mod.rs:833 which suggests direct byte indexing like &s[0..6] instead of using char-aware methods.
Workaround
No reliable workaround. Temporarily removing Korean text from project files avoids the issue, but this is not practical for Korean-language projects.
Expected Behavior
Claude Code should handle UTF-8 multibyte characters (Korean, Japanese, Chinese, emoji, etc.) without panicking.
Additional Context
This affects any project using non-ASCII characters in documentation or code comments.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗