[BUG] Edit tool crashes with Rust panic when editing Korean/CJK multi-byte UTF-8 text
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?
The Edit tool causes a Rust panic when editing files containing Korean (or other multi-byte UTF-8) text. The CLI crashes completely and terminates the session, losing any unsaved work.
The error occurs because string indexing calculates byte positions that fall in the middle of multi-byte UTF-8 characters (Korean characters are 3 bytes in UTF-8).
What Should Happen?
The Edit tool should correctly handle multi-byte UTF-8 characters by using character-aware indexing instead of byte-based indexing. Edits to Korean, Chinese, Japanese, emoji, and other Unicode text should work without crashing.
Error Messages/Logs
thread '<unnamed>' panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 9 is not a char boundary; it is inside '는' (bytes 7..10) of ` 평가는 익명 라벨로 진행되었습니다.`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
---
thread '<unnamed>' panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 2 is not a char boundary; it is inside '이' (bytes 0..3) of `이`);`
fatal runtime error: failed to initiate panic, error 5, aborting
Steps to Reproduce
- Open a project containing files with Korean text (JSX, JS, or any text file)
- Ask Claude to edit Korean strings using the Edit tool
- Example: "Change '상호 평가' to '크로스 심판' in the JSX file"
- CLI crashes with Rust panic before or during the edit operation
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
Terminal.app (macOS)
Additional Information
<img width="752" height="1287" alt="Image" src="https://github.com/user-attachments/assets/019d7740-e590-4e4e-b30f-6f07e871be3b" />
- This bug is 100% reproducible when editing Korean text
- Likely affects all CJK (Chinese, Japanese, Korean) languages and emoji
- Workaround: Use Write tool to rewrite entire file instead of Edit tool
- Screenshot attached showing the crash in terminal
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗