[BUG] Rust panic on UTF-8 Chinese string: byte index not at char boundary

Resolved 💬 3 comments Opened Dec 20, 2025 by wayne930242 Closed Dec 20, 2025

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?

Claude Code crashes with a Rust panic when processing Chinese UTF-8 strings in certain contexts.

What Should Happen?

Claude Code should handle Chinese (and other multi-byte UTF-8) strings correctly without crashing.

The Rust code should use character-aware string operations (e.g., .chars(), .char_indices()) instead of byte-level slicing when working with user-provided or displayed strings.

Error Messages/Logs

thread '<unnamed>' (89062603) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
  byte index 11 is not a char boundary; it is inside '制' (bytes 9..12) of `飛行控制`
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  fatal runtime error: failed to initiate panic, error 5, aborting

Steps to Reproduce

  1. Work on a project that contains Chinese characters in code comments, strings, or file content
  2. 2. The specific string that triggered the crash was 飛行控制 (flight control)
  3. 3. Claude Code attempts to process/display the string
  4. 4. Crash occurs with the byte index boundary error

Context: This occurred during normal Claude Code operation in a Next.js project with Traditional Chinese content. The exact trigger is unclear, but appears related to internal string truncation or display logic.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.74 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • Browser automation (MCP) enabled via claude-in-chrome
  • Next.js project with Traditional Chinese content

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗