Panic on Chinese character boundary when processing UTF-8 strings
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?
Version: 2.0.76
OS: macOS Darwin 25.1.0
Error:
byte index 2 is not a char boundary; it is inside '户' (bytes 0..3)
What Should Happen?
The CLI crashes intermittently when processing conversations
containing Chinese characters.
Error Messages/Logs
Steps to Reproduce
- Start Claude Code CLI:
claude - Have a conversation that includes Chinese characters
- The crash occurs intermittently during the conversation,
particularly when:
- The conversation becomes longer
- Switching between messages
- Status bar or UI elements are being updated
## Environment
- Claude Code version: 2.0.76
- OS: macOS Darwin 25.1.0
- Terminal: [你用的终端,如 iTerm2 / Terminal.app / Warp]
- Shell: zsh
## Frequency
The crash happens multiple times during extended conversations
containing Chinese text. Not every session, but frequently enough
to disrupt workflow.
## Additional Context
The error message specifically mentions '户' but this appears to be
whichever Chinese character happens to be at the truncation point.
The root cause seems to be byte-indexing instead of char-boundary
indexing when slicing UTF-8 strings.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.0.76
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗