[BUG] Rust panic: "byte index 2 is not a char boundary" when processing emoji (✅)
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 error when processing text containing emoji characters.
The panic occurs because the code attempts to slice a UTF-8 string at byte index 2,
which falls inside the multi-byte emoji character '✅' (which occupies bytes 0..3).
This appears to be a string handling issue where byte-based indexing is used instead
of character-boundary-aware slicing for multi-byte UTF-8 characters.
What Should Happen?
Claude Code should handle emoji and other multi-byte UTF-8 characters correctly
without crashing. String operations should use character-boundary-aware methods
instead of raw byte indexing.
Error Messages/Logs
thread '<unnamed>' (1563082) 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 `✅`
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
- Run Claude Code in terminal
- [여기에 오류가 발생했을 때 수행하던 작업을 구체적으로 작성하세요]
예: "Send a prompt containing emoji characters like ✅"
또는 "Use a CLAUDE.md file containing emoji markers"
- The application crashes with the above panic message
Note: The exact trigger is unclear, but the error involves processing
the ✅ emoji character.
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
Other
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
Related Issues
- Possibly related to #6903 (Unicode Codepoint Corruption)
- Similar to openai/codex#3261
## Suggested Fix
Use str.char_indices() or str.chars() for string slicing instead of
direct byte indexing to ensure operations occur at valid UTF-8 character boundaries.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗