Panic: UTF-8 boundary error when rendering status line with emoji

Resolved 💬 3 comments Opened Jan 8, 2026 by bbarkhurst77 Closed Jan 11, 2026

Description

Claude Code crashes with a Rust panic when rendering a status line containing multi-byte UTF-8 characters (emoji).

Error

thread '<unnamed>' (1656541) 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
Aborted

Analysis

The crash occurs when slicing a string at byte index 2, but the (white square) emoji occupies bytes 0-3. The string slicing logic doesn't account for multi-byte UTF-8 characters.

The string ⬜ | suggests this is in a progress/status indicator or todo list rendering.

Environment

  • Platform: Linux (Raspberry Pi 5)
  • OS: Linux 6.12.47+rpt-rpi-2712

Suggested Fix

Use character-aware string slicing (e.g., .chars().take(n) or the unicode-segmentation crate) instead of byte-based slicing when truncating display strings.

View original on GitHub ↗

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