[BUG] Panic on UTF-8 emoji character during Edit operation
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 told me this is a bug and that it is reportable.
What Should Happen?
Claude Code crashes with a Rust panic when attempting to edit files containing multi-byte UTF-8 characters (specifically emojis like 🔲).
Error message:
thread '<unnamed>' (377726) panicked at .../library/core/src/str/mod.rs:833:21:
byte index 3 is not a char boundary; it is inside '🔲' (bytes 0..4) of 🔲 PLACEHOLDER
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
Aborted (core dumped)
Root cause: The code is indexing into a UTF-8 string at byte position 3, but the 🔲 emoji is 4 bytes (U+1F532). Byte index 3 falls in the middle of this character, which is invalid in Rust's string slicing.
Reproduction:
- Edit a markdown file containing the 🔲 emoji
- Perform an edit operation that modifies text near or including the emoji
Expected: Handle multi-byte UTF-8 characters correctly by using character boundaries, not byte indices.
Error Messages/Logs
● Update(docs/IMPLEMENTATION_PLAN.md)
✽ Testing and committing changes… (esc to interrupt · 14m 45s · thinking)
────────────────────────────────────────────────────────────────────────────
────
>
────────────────────────────────────────────────────────────────────────────
────
⏵⏵ accept edits on (shift+tab to cycle) Context left until auto-compact:
4%
thread '<unnamed>' (377726) panicked at /rustc/ed61e7d7e242494fb7057f2657300
d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 3 is not a char boundary; it is inside '🔲' (bytes 0..4) of `🔲
PLACEHOLDER`
note: run with `RUST_BACKTRACE=1` environment variable to display a
backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
Aborted (core dumped)
Steps to Reproduce
I think it was a once off.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
Claude Opus 4.5 (model ID: claude-opus-4-5-20251101).
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Xterm
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗