claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Rust panic: UTF-8 string slicing error with Korean characters

Open edari-bridge opened this issue 11 months ago • 1 comments

Description

Claude Code CLI crashes with a Rust panic when processing Korean text. The error occurs during UTF-8 string handling where the code attempts to slice at a byte index that falls inside a multi-byte character.

Error Message

thread '<unnamed>' (4601747) 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 `료, 나만의 API 키로 이미지 생성.`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort      claude

Analysis

  • The Korean character '료' is encoded as 3 bytes in UTF-8 (bytes 0-2)
  • The code attempts to slice the string at byte index 2
  • Byte index 2 is inside the '료' character, not at a valid character boundary
  • This causes a Rust panic

Environment

  • OS: macOS (Darwin 24.6.0)
  • Shell: zsh

Expected Behavior

Claude Code should properly handle UTF-8 multi-byte characters (Korean, Japanese, Chinese, emoji, etc.) without crashing.

Suggested Fix

Use character-aware string operations instead of byte-based slicing. In Rust, this typically means using .chars() iterator or char_indices() instead of direct byte indexing.

edari-bridge avatar Dec 31 '25 16:12 edari-bridge

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14133
  2. https://github.com/anthropics/claude-code/issues/15157
  3. https://github.com/anthropics/claude-code/issues/15648

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 31 '25 16:12 github-actions[bot]

This issue has been automatically closed as a duplicate of #14133.

If this is incorrect, please re-open this issue or create a new one.

🤖 Generated with Claude Code

github-actions[bot] avatar Jan 04 '26 09:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 12 '26 14:01 github-actions[bot]