Skip to content

[BUG] Edit tool crashes with Rust panic when editing Korean/CJK multi-byte UTF-8 text #16609

@crucial-sub

Description

@crucial-sub

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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

  1. Open a project containing files with Korean text (JSX, JS, or any text file)
  2. Ask Claude to edit Korean strings using the Edit tool
  3. Example: "Change '상호 평가' to '크로스 심판' in the JSX file"
  4. 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

Image
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:corearea:toolsbugSomething isn't workingduplicateThis issue or pull request already existshas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOS

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions