Skip to content

[BUG] Crash when editing Korean (UTF-8 multi-byte) strings - byte index not on char boundary #16589

@hanisoft2022

Description

@hanisoft2022

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?

Description

Claude Code CLI crashes when editing strings containing Korean characters.

Error

thread '' panicked at .../library/core/src/str/mod.rs:833:21:
byte index 9 is not a char boundary; it is inside '의' (bytes 7..10)
fatal runtime error: failed to initiate panic, error 5, aborting

Environment

  • Claude Code: v2.0.76
  • OS: macOS Darwin 25.1.0

Root Cause

Rust code uses byte indices instead of character indices when slicing UTF-8 strings. Korean characters are 3 bytes each.

Workaround

Use Read → Write instead of Edit for files with non-ASCII characters.

What Should Happen?

The Edit tool should correctly handle multi-byte UTF-8 characters (Korean, Japanese, Chinese, emoji, etc.) 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 ` 다음의 방법으로 고지합니다:`
  fatal runtime error: failed to initiate panic, error 5, aborting

Steps to Reproduce

  1. Open a file containing Korean text (e.g., TSX file with Korean strings)
  2. Use Edit tool to replace a short Korean string like "다음의 방법으로"
  3. CLI crashes with "byte index is not a char boundary" panic

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

iTerm2

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:toolsbugSomething isn't workinghas 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