[BUG] Panic on Korean UTF-8 string boundary when displaying edit UI
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?
Description
Claude Code crashes with a Rust panic when handling Korean (한글) text in the edit acceptance UI. The error occurs due to incorrect UTF-8 byte indexing on multi-byte characters.
Root Cause
I don't know. This report is generated by claude-code.
The panic occurs because the code attempts to index into a Korean UTF-8 string at byte position 5, which falls in the middle of the character '집' (bytes 3-6). Korean characters in UTF-8 are 3 bytes each, and the string 편집, 삭제 | is being incorrectly sliced at a non-character boundary.
Environment
- OS: macOS (Darwin 24.6.0)
- Platform: darwin
- Node.js: v22.14.0
- Claude Code Version: 2.0.76
Additional Context
This appears to be a string slicing issue in the Rust portion of Claude Code where character boundaries are not being respected for non-ASCII text. The fix would involve using character-aware string operations (e.g., .chars() iterator) instead of byte indexing.
What Should Happen?
Expected Behavior
Claude Code should properly handle multi-byte UTF-8 characters (Korean, Chinese, Japanese, emoji, etc.) without crashing.
Error Messages/Logs
thread '<unnamed>' (37091) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 5 is not a char boundary; it is inside '집' (bytes 3..6) 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
Steps to Reproduce
Steps to Reproduce
- Run Claude Code with a Korean locale or Korean UI text
- Trigger the edit acceptance flow (shift+tab to cycle through options)
- The application crashes when trying to render/process the Korean text "편집, 삭제 |"
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
I use ghostty.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗