claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Panic on Korean (UTF-8 multi-byte) characters in todo/task description

Open sichiro opened this issue 11 months ago • 4 comments

Description

Claude Code CLI crashes with a Rust panic when processing Korean characters in task descriptions or todo items.

Error Message

thread '<unnamed>' (7574024) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 12 is not a char boundary; it is inside '가' (bytes 10..13) of `날짜 추가 (기본 파일도 함께 생성)`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1]    93452 abort      claude -c

Root Cause

The code is attempting to slice a UTF-8 string at byte index 12, which falls in the middle of the Korean character '가' (bytes 10-13). Korean characters are 3 bytes in UTF-8, and slicing at a non-character boundary causes a panic.

Steps to Reproduce

  1. Use Claude Code CLI
  2. Create a todo item or task with Korean text (e.g., 날짜 추가 (기본 파일도 함께 생성))
  3. The CLI crashes with the above panic

Expected Behavior

The CLI should properly handle UTF-8 multi-byte characters (Korean, Chinese, Japanese, emoji, etc.) when truncating or processing strings.

Environment

  • Platform: macOS (Darwin 25.1.0)
  • Claude Code CLI version: latest

Suggested Fix

Use character-boundary-aware string slicing instead of byte-based slicing. In Rust, this can be done using .char_indices() or the unicode-segmentation crate to find proper character boundaries before truncating.

🤖 Generated with Claude Code

sichiro avatar Dec 22 '25 04:12 sichiro

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14133
  2. https://github.com/anthropics/claude-code/issues/14873
  3. https://github.com/anthropics/claude-code/issues/14862

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Dec 22 '25 05:12 github-actions[bot]

Additional Case: Japanese Characters in File Content

I'm experiencing the same UTF-8 multi-byte character boundary issue, but with Japanese text in file content rather than task descriptions.

Environment:

  • OS: Linux (WSL2)
    • Claude Code version: latest

Error Message:

thread '<unnamed>' panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 80 is not a char boundary; it is inside '数' (bytes 78..81) of 続攻撃回数, 攻撃間隔倍率, 連射間隔秒数, サイクル間隔秒数, 攻撃開始遅延秒数)

Steps to Reproduce:

  1. Create or edit a file containing Japanese comments
    1. Include long lines with Japanese text (e.g., C# code with Japanese comments)
    1. Claude Code crashes when trying to display/process the file content

Key Observation:

This is a broader UTF-8 handling issue affecting multiple contexts:

  • ✅ Task/todo descriptions (reported in #15035)
    • ✅ File content processing (my case - Japanese in C# comments)
      • Likely affects other multi-byte character languages (Chinese, Korean, etc.) The root cause is the same: byte-index-based string slicing without checking character boundaries.

This suggests the problem is more widespread than initially thought and should be prioritized for fixing.

ChibaMeizin avatar Dec 22 '25 11:12 ChibaMeizin

I'm also experiencing the same issue. Sharing my case in hopes it might help.

※ This details comment moved to #14133

original

Environment

  • Claude Code version: 2.0.74
  • OS: macOS 14.4.1 / Darwin 23.4.0 (Apple M3 Pro)
  • Shell: zsh

Steps to reproduce

  1. Open Claude Code CLI
  2. Ask Claude to edit or create a file containing Japanese (multi-byte) text
  3. The panic occurs randomly during file operations

Expected behavior

File operations with Japanese text should complete successfully.

Actual behavior

Claude Code crashes with a panic:

thread '<unnamed>' panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 26 is not a char boundary; it is inside 'き' (bytes 24..27) of `元ファイルに上書き`
stack backtrace:
   0:        0x1495ed33c - <unknown>
   1:        0x14955ab10 - <unknown>
   2:        0x1495ecab8 - <unknown>
   3:        0x1495ed154 - <unknown>
   4:        0x1495ec760 - <unknown>
   5:        0x14960ef14 - <unknown>
   6:        0x14960ee84 - <unknown>
   7:        0x14960ee78 - <unknown>
   8:        0x149558960 - <unknown>
   9:        0x1495588c0 - <unknown>
  10:        0x1495586e0 - <unknown>
  11:        0x149520bcc - <unknown>
  12:        0x14951c2ac - <unknown>
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort      RUST_BACKTRACE=full claude --resume

Additional context

  • File type does not matter (CSV, Markdown, etc.) - any file containing Japanese text can trigger this
  • The panic handler itself fails (error 5), so full backtrace symbols are not available

Workarounds attempted

  • Direct file editing: Asked Claude to edit CSV/Markdown files directly - high crash rate
  • Python script workaround: Instead of direct editing, asked Claude to modify files via Python scripts - reduces frequency but still crashes occasionally
  • RUST_BACKTRACE=1: Stack trace shows <unknown> due to stripped symbols
  • RUST_BACKTRACE=full: Same result, no additional symbol information

Impact

This issue occurs very frequently when working with Japanese text, making Claude Code practically unusable for my workflow. I have been forced to use alternatives like OpenAI Codex as a workaround. Would really appreciate a fix for this.

takatea avatar Dec 22 '25 12:12 takatea

When processing CLAUDE.md, the program attempted to split the string at the middle of the character “义” (the 20th byte). However, this position fell within a multi-byte UTF-8 character (bytes 18–21), causing the program to panic. This error occurred during text processing.

Chinese

daniuge888 avatar Dec 22 '25 12:12 daniuge888

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Jan 23 '26 10:01 github-actions[bot]

FYI: This issue appears to be fixed in v2.1.6!

Changelog: https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md#216 Reference: https://github.com/anthropics/claude-code/issues/14133#issuecomment-2739536291

Hope this helps!

takatea avatar Jan 23 '26 10:01 takatea

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] avatar Feb 28 '26 10:02 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Mar 07 '26 14:03 github-actions[bot]