[BUG] UTF-8 Korean string slicing panic - byte index not a char boundary

Resolved 💬 3 comments Opened Dec 23, 2025 by doublek13 Closed Feb 14, 2026

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?

## Bug Description
Claude Code panics when processing Korean (UTF-8) strings, attempting to slice at byte boundaries that fall in the middle of multi-byte characters.

## Error Message
thread '<unnamed>' panicked at /rustc/.../library/core/src/str/mod.rs:833:21:
byte index 14 is not a char boundary; it is inside '오' (bytes 12..15) of 서푸르지오 방문예약
fatal runtime error: failed to initiate panic, error 5, aborting

## Environment

  • OS: macOS Darwin 24.6.0
  • Claude Code version: 2.0.76
  • Language: Korean (한국어)

## Root Cause
Korean characters are 3 bytes each in UTF-8. The code slices at byte index 14, which falls inside '오' (bytes 12-14).

## Impact
Makes Claude Code unusable for projects containing Korean text.

What Should Happen?

Claude Code should handle Korean (and all UTF-8 multi-byte characters) correctly without panicking.

Specifically:

  1. String slicing should use character boundaries, not raw byte indices
  2. When processing file paths, content, or session data containing Korean text, Claude Code should work normally
  3. If string truncation is needed, it should use safe UTF-8 aware methods like:
  • str.chars().take(n) instead of &str[..n]
  • str.char_indices() for finding valid slice points

No crashes should occur when working in directories or with files containing non-ASCII characters.

Error Messages/Logs

Steps to Reproduce

  1. Create or open a project directory containing files with Korean text

Example: A website project with Korean content like "달서푸르지오 방문예약"

  1. Run Claude Code in that directory:

claude

  1. Perform any operation that triggers internal caching/indexing

(e.g., reading files, using TodoWrite, or session persistence)

  1. The panic occurs during Claude Code's internal string processing

Alternative reproduction:

  • Work in a directory path containing Korean characters
  • Or have Korean text in file names
  • Or have Korean content that gets cached in ~/.claude/todos/ or ~/.claude/projects/

Claude Model

Sonnet (default)

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

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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