Crash when editing Markdown files with Chinese text (byte boundary error)
Resolved 💬 3 comments Opened Dec 19, 2025 by Youngminds64 Closed Dec 23, 2025
Claude Code crashes frequently when editing Markdown files containing Chinese text.
Error
thread '<unnamed>' panicked at library/core/src/str/mod.rs:833:21:
byte index 120 is not a char boundary; it is inside '表' (bytes 118..121)
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort claude
Environment
- Version: 2.0.73
- OS: macOS (Darwin 25.1.0)
- Locale: zh_CN.UTF-8
- Files: UTF-8 encoded
When it happens
- Trigger: When executing file edit commands on Markdown files with Chinese content
- Frequency: Started happening frequently after updating to 2.0.73
- Use case: Editing documents with tables containing longer Chinese text (e.g., PRD documents)
Root cause
The code is slicing strings at fixed byte indices (e.g., byte 120) without checking UTF-8 character boundaries. Chinese characters use 3 bytes each, so slicing in the middle causes the panic.
Suggested fix
Use char_indices() or check is_char_boundary() before slicing strings to properly handle multi-byte UTF-8 characters.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗