[BUG] Rust panic on UTF-8 char boundary when processing Korean text files
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 Rust panic when processing text files containing Korean (or other multi-byte UTF-8) characters. The panic occurs because the code attempts to slice a string at a byte index that falls in the middle of a multi-byte character.
What Should Happen?
Claude Code should properly handle UTF-8 multi-byte characters by ensuring string slicing only occurs at valid character boundaries, not arbitrary byte positions.
Error Messages/Logs
thread '<unnamed>' (79760) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:
byte index 86 is not a char boundary; it is inside '요' (bytes 84..87) of `엔 달력 보면서 손으로 계산했는데, 계산이 틀린 적도 있었거든요.`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Steps to Reproduce
- Create a text file containing Korean text, for example:
옛날엔 달력 보면서 손으로 계산했는데, 계산이 틀린 적도 있었거든요.
- Open Claude Code in the directory containing this file
- Attempt to update or process the file (e.g., editing, reading with truncation)
- The Rust panic occurs when the string is sliced at a non-character boundary
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.76 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Terminal.app (macOS)
Additional Information
This is a common Rust UTF-8 handling issue. The fix typically involves using .chars() iterator or .char_indices() instead of direct byte indexing, or using safe slicing methods that respect character boundaries.
The bug appears to occur in a string truncation or display formatting context, possibly when showing file update notifications or content previews.
Affected text was from a Korean lecture script file: 2026-01-07_강의스크립트_30분_초안.txt
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗