## 🚨 CRITICAL: Rust panic when reading files with Japanese characters in textarea
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?
### Summary
Claude Code crashes with a fatal runtime error when reading PHP files containing Japanese text within textarea elements. This causes complete session termination and data loss.
### Error Message
thread '' panicked at /rustc/.../library/core/src/str/mod.rs:833:21:
byte index 1 is not a char boundary; it is inside 'け' (bytes 0..3) of け'); ?></textarea>
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)
### Environment
- OS: WSL2 (Linux 6.6.87.2-microsoft-standard-WSL2)
- Claude Code version: Latest
- File encoding: UTF-8
### Steps to Reproduce
- Create a PHP file with Japanese text inside a textarea default value:
```php
<textarea><?php echo h($var ?? '日本語テキスト逝け!'); ?></textarea>
- Run Claude Code in the directory
- Attempt any operation that reads the file
Impact
- Severity: Critical
- Frequency: 100% reproducible
- Data Loss: Session terminates abruptly, unsaved work lost
- Workaround: None - cannot work with files containing this pattern
Root Cause
Rust string slicing at byte index 1 fails because Japanese character 'け' occupies bytes 0-3. The code incorrectly assumes ASCII byte boundaries.
Expected Behavior
Claude Code should handle UTF-8 multi-byte characters correctly without crashing.
Suggested Fix
Use char_indices() or grapheme_indices() instead of direct byte indexing when processing string content.
---日本語が問題みたいですが、すぐにオチて使い物にならなくなってきた至急対策を!
What Should Happen?
途中で停止するのは辞めてください!すぐ落ちて何度も何度も立ち上げなおさないといけないです。途中でクラッシュしないように!
Error Messages/Logs
thread '<unnamed>' (617546) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 1 is not a char boundary; it is inside 'け' (bytes 0..3) of `け'); ?></textarea>`
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)
Trigger file: admin/settings.php
Trigger pattern: Japanese text inside PHP textarea default value
Example: <textarea><?php echo h($var ?? '...逝け!'); ?></textarea>
The character 'け' (U+3051, 3 bytes in UTF-8) causes byte boundary violation when sliced at index 1.
Steps to Reproduce
10分程度でおちます。
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
2.0.76
Claude Code Version
2.0.76
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
### Environment Details
- OS: WSL2 on Windows (Linux 6.6.87.2-microsoft-standard-WSL2)
- Shell: Bash
- File System: NTFS via /mnt/c/ (Windows path mounted in WSL)
- File Encoding: UTF-8 (verified with
file -i)
### Reproduction Steps
- Create a PHP file with this content:
```php
<textarea><?php echo h($value ?? '今すぐ逝け!'); ?></textarea>
- Navigate to the directory containing this file
- Run any Claude Code command that triggers file reading (e.g., search, edit, or exploration)
- Claude Code crashes immediately
Minimal Reproducible Example
<?php
// test.php - Minimal crash trigger
?>
<textarea><?php echo '逝け'; ?></textarea>
Observations
- Crash occurs during file content parsing, not during explicit file read
- The specific character 'け' (hiragana KE, U+3051) is mentioned in error
- Panic occurs in Rust's core string module (str/mod.rs:833)
- Error 5 in panic handler suggests memory/thread issue
Workaround Attempted
- None successful - avoiding the file entirely is the only option
- Cannot use --exclude patterns as crash happens before command processing
Frequency
- 100% reproducible
- Affects all operations in directories containing such files
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗