[BUG] Multi-byte UTF-8 characters (Korean, emoji) cause panic: byte index is not a char boundary

Resolved 💬 5 comments Opened Dec 18, 2025 by blacklabf Closed Dec 21, 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?

Description

Claude Code CLI crashes with a Rust panic when processing multi-byte UTF-8 characters (Korean text, emoji) in project files.

## Error Messages

### Case 1: Korean character '됨' (3 bytes)
thread '' (6740956) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 58 is not a char boundary; it is inside '됨' (bytes 56..59) of 이지로 이동해야 하는데 바로 로그인까지 됨 (사용자 확인 플로우 누락)
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 --dangerously-skip-permissions

### Case 2: Emoji '🔄' (4 bytes)
thread '' (6721234) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 4 is not a char boundary; it is inside '🔄' (bytes 1..5) of 🔄 | |
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 --dangerously-skip-permissions

## Root Cause
The CLI is slicing UTF-8 strings at raw byte indices instead of character boundaries. This affects any multi-byte character:

  • Korean/Chinese/Japanese characters (3 bytes each)
  • Emoji (4 bytes each)
  • Other non-ASCII UTF-8 characters

What Should Happen?

Claude Code CLI should correctly handle all UTF-8 characters without crashing. String slicing operations must respect character boundaries using
proper Rust string methods like .chars(), .char_indices(), or floor_char_boundary().

Error Messages/Logs

# Case 1: Korean                                                                                                                                 
  thread '<unnamed>' (6740956) panicked at library/core/src/str/mod.rs:833:21:                                                                     
  byte index 58 is not a char boundary; it is inside '됨' (bytes 56..59)                                                                           
                                                                                                                                                   
  # Case 2: Emoji                                                                                                                                  
  thread '<unnamed>' (6721234) panicked at library/core/src/str/mod.rs:833:21:                                                                     
  byte index 4 is not a char boundary; it is inside '🔄' (bytes 1..5)

Steps to Reproduce

## Reproduce with Korean text:

  1. Have a markdown file with Korean text like:

이지로 이동해야 하는데 바로 로그인까지 됨 (사용자 확인 플로우 누락)

  1. Run claude in the project directory
  2. CLI crashes with panic

## Reproduce with Emoji:

  1. Have a markdown file with emoji in tables like:

```markdown
| 결과 |
|------|
| 🔄 |

  1. Run claude and try to edit the file
  2. CLI crashes with panic

Context

The crash occurred while Claude was updating a test scenario document (docs/종합_테스트_시나리오.md) containing both Korean text and status emoji
(✅, ❌, 🔄) in markdown tables.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.72 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

### Additional Information
```markdown
## Affected Characters

  • Korean characters: 됨, 이, 로, etc. (3 bytes each in UTF-8)
  • Emoji: 🔄, ✅, ❌ (4 bytes each in UTF-8)

## Use Case
Working on a Korean language project with test documentation containing:

  • Korean descriptions
  • Status emoji in markdown tables (✅ pass, ❌ fail, 🔄 in progress)

## Technical Fix Suggestion
Replace raw byte slicing like &s[0..n] with:

  • s.chars().take(n).collect::<String>() for character-based truncation
  • s.get(..s.floor_char_boundary(n)) (Rust 1.73+) for safe byte slicing
  • s.char_indices() to find valid slice points

## Impact
This bug makes Claude Code unusable for:

  • Korean/Chinese/Japanese language projects
  • Any project using emoji in documentation
  • Internationalized codebases

View original on GitHub ↗

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