[BUG] UTF-8 Korean string slicing panic - byte index not a char boundary
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 '서푸르지오 방문예약
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:
- String slicing should use character boundaries, not raw byte indices
- When processing file paths, content, or session data containing Korean text, Claude Code should work normally
- 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
-
Create or open a project directory containing files with Korean text Example: A website project with Korean content like "달서푸르지오 방문예약"
-
Run Claude Code in that directory: claude
-
Perform any operation that triggers internal caching/indexing (e.g., reading files, using TodoWrite, or session persistence)
-
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