[Bug] UTF-8 String Indexing Panic with Multi-byte Characters

Resolved 💬 6 comments Opened Jan 7, 2026 by a-tak Closed Feb 8, 2026

Bug Description

Summary

When using Claude Code, the application crashes with a Rust panic when processing text that contains Japanese (multi-byte UTF-8) characters.

---

Issue

While handling text that includes Japanese characters, Claude Code triggers the following Rust panic:

thread '<unnamed>' (23894828) panicked at
/library/core/src/str/mod.rs:833:21:
byte index 49 is not a char boundary;
it is inside '、' (bytes 47..50)

Once this error occurs, Claude Code cannot continue execution and crashes.

---

Suspected Cause

It appears that some string operations on Rust str values are being performed using byte-based indexing rather than character-safe methods.

Because Japanese characters are multi-byte in UTF-8, slicing or indexing a string at an invalid byte position can cause a panic.
In this case:

  • The access is attempted at byte index 49
  • The byte index falls inside the Japanese character (which occupies bytes 47–50)

This strongly suggests that the code is not properly handling UTF-8 character boundaries.

---

Reproduction

  • Use or process text that contains Japanese (UTF-8 multi-byte) characters
  • During a certain internal operation (e.g. state update), the panic occurs
  • The issue does not seem to occur (or is much less likely) when using English-only text

Precise reproduction steps are not fully identified, but the crash occurs frequently when Japanese text is involved.

---

Expected Behavior

  • Claude Code should safely handle UTF-8 text, including Japanese characters
  • No invalid character boundary access should occur
  • The application should not crash due to a Rust panic

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.0.76
  • Feedback ID:

Errors

[{"error":"Error\n    at ak (/$bunfs/root/claude:59:1144)\n    at <anonymous> (/$bunfs/root/claude:60:10093)\n    at emit (node:events:92:22)\n    at endReadableNT (internal:streams/readable:861:50)\n    at processTicksAndRejections (native:7:39)\n    at request (/$bunfs/root/claude:62:2149)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-07T10:50:09.326Z"},{"error":"Error\n    at ak (/$bunfs/root/claude:59:1144)\n    at <anonymous> (/$bunfs/root/claude:60:10093)\n    at emit (node:events:92:22)\n    at endReadableNT (internal:streams/readable:861:50)\n    at processTicksAndRejections (native:7:39)\n    at request (/$bunfs/root/claude:62:2149)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-01-07T10:57:56.902Z"}]

View original on GitHub ↗

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