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

[BUG] Rust panic on Korean (UTF-8) input: "byte index is not a char boundary" when processing '필터 적용'

Open kimyoungwopo opened this issue 11 months ago • 16 comments

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?

Claude Code CLI crashes with a Rust panic when handling Korean (UTF-8 multibyte) text, and the process aborts immediately.

The key error is:

  • byte index 13 is not a char boundary
  • it is inside '용' (bytes 11..14) of '필터 적용'

This strongly suggests the CLI is performing byte-index string slicing (or similar substring operations) and attempts to cut a UTF-8 string at a position that is not a valid character boundary, which causes a panic and abort.

Steps to Reproduce 1.Run claude --dangerously-skip-permissions 2.Ensure Korean text appears in the input/output/prompt (e.g., 필터 적용) 3.Observe the panic and immediate abort

Actual Result -Rust panic occurs and the CLI aborts, making the tool unusable in this scenario.

Expected Result -The CLI should handle Korean/Unicode input safely without crashing. -At minimum, it should gracefully report an error and continue running.

Environment -Claude Code: 2.0.70 -Binary path:.local/bin/claude -OS: macOS (add version if available)

What Should Happen?

Even when Korean (UTF-8 multibyte) text appears in the input/output/prompt, the CLI should continue to work normally and must not crash due to a panic.

Error Messages/Logs

thread '<unnamed>' (1031632) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 13 is not a char boundary; it is inside '용' (bytes 11..14) of
`'필터 적용'}`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1]    75263 abort      claude --dangerously-skip-permissions

Steps to Reproduce

1.Open a terminal on macOS. 2.Run: claude --dangerously-skip-permissions 3.Trigger any flow where Korean (UTF-8 multibyte) text appears in the input/output/prompt (e.g., 필터 적용). 4.The CLI crashes with a Rust panic and aborts, showing byte index ... is not a char boundary.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

v2.0.70

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

kimyoungwopo avatar Dec 16 '25 07:12 kimyoungwopo


Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14119
  2. https://github.com/anthropics/claude-code/issues/14104

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 16 '25 07:12 github-actions[bot]

👎

kimyoungwopo avatar Dec 16 '25 07:12 kimyoungwopo

Same issues https://github.com/anthropics/claude-code/issues/14272 https://github.com/anthropics/claude-code/issues/14287 https://github.com/anthropics/claude-code/issues/14435

hojongs avatar Dec 18 '25 13:12 hojongs

Claude CLI 2.0.73 macOS 26.0.1

I'm experiencing same issue too It happens without --dangeriously-sip-permissions too

JeiKeiLim avatar Dec 19 '25 07:12 JeiKeiLim

same issue. claude code cli v2.0.75 windows 10 pro

the error messages are almost identical to the original issuer's. no problem with v2.0.72. when i continue claude code cli with --resume, it seems ok for a while. but when i try /export command, then it always happens.

mysehyunhope avatar Dec 21 '25 12:12 mysehyunhope

This also affects Japanese text, particularly the Japanese period 。 (U+3002, 3 bytes in UTF-8).

The 。 character appears at the end of almost every sentence in Japanese, making this bug especially disruptive for Japanese users.

Related Japanese issues:

  • #14104 (Open): Crash with kanji 発 and box-drawing characters
  • #14272 (Closed as dup): Crash with kanji 除

Example error: byte index 17 is not a char boundary; it is inside '。' (bytes 15..18)

hsugawa8651 avatar Dec 21 '25 14:12 hsugawa8651

I'm experiencing the same issue with Japanese characters.

Error message:

thread '<unnamed>' (65034) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 14 is not a char boundary; it is inside '正' (bytes 12..15) of `ド後に修正`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: IOT instruction (core dumped)  claude

Context: The crash occurred when Claude Code was processing a PHP file containing the following Japanese comment:

// @phpstan-ignore-line TODO doctrine/orm 3.x アップグレード後に修正

The panic message shows it was trying to slice the string ド後に修正 (part of "アップグレード後に修正" meaning "fix after upgrade") at byte index 14, which falls inside the multi-byte character '正'.

Environment:

  • Platform: Linux (WSL2)
  • Claude Code version: Latest

nanasess avatar Dec 22 '25 07:12 nanasess

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


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 18:12 takatea

Same issue here.

Environment:

  • Claude Code: 2.0.75
  • OS: macOS (Darwin 24.3.0)
  • Platform: Apple Silicon (arm64)

Reproduction:

  • Crash occurs when Korean text appears in todo/task descriptions
  • Very frequent issue for Korean users

+1 for prioritizing this fix 🙏

shindonghwi avatar Dec 23 '25 00:12 shindonghwi

same to me

PANXIONG-CN avatar Dec 24 '25 01:12 PANXIONG-CN

같은 이슈 재현 (Ubuntu 24.04)

환경:

  • OS: Ubuntu 24.04
  • Claude Code: 2.0.76

에러:

thread '<unnamed>' (86293) 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 ` 아이템에 대해 다양한 관점의 콘텐츠를 생성합니다.`
[1]    86293 IOT instruction (core dumped)

흥미로운 발견:

2025년인데 3바이트 UTF-8 문자 하나가 프로그램을 멈춘다는 게 신기하네요. '에' 라는 한글 음절이 그렇게 위험한 문자였나요?

Rust의 .chars() 메서드는 2015년부터 있었던 걸로 아는데, 바이트 인덱스 슬라이싱을 고집하시는 특별한 이유가 있으신지 궁금합니다.

이미 #14392, #14310, #14862 등 유사 이슈가 계속 올라오는 걸 보니 CJK 사용자들은 "아직은 때가 아닌가보다" 하고 조용히 기다리는 중입니다.

언젠가 한국어로 코딩할 수 있는 날이 오겠죠. 그때까지 영어 주석으로 버텨보겠습니다.


Written by Claude AI 🤖

id-ego avatar Dec 25 '25 04:12 id-ego

동일 이슈 발생

OS : mac Sequoia 15.6.1 Claude Code : 2.0.76

thread '' (4584184) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21: byte index 23 is not a char boundary; it is inside '신' (bytes 21..24) of 그아웃, 토큰 갱신, 현재 관리자 정보) note: run with RUST_BACKTRACE=1 environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5, aborting [1] 78778 abort claude

gpflawkd2 avatar Dec 26 '25 08:12 gpflawkd2

Additional crash report

Environment:

  • OS: macOS (Darwin 24.5.0)
  • Claude Code version: Latest

Crash log:

thread '<unnamed>' (9868011) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 2 is not a char boundary; it is inside '를' (bytes 0..3) of `를 수집하고, LLM을 활용하여 자동으로 동의어를 생성한 후, Neo4j 그래프 데이터베이스에 저장한다.`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort      claude --permission-mode bypassPermissions

Analysis:

  • Korean character '를' occupies bytes 0-3 (UTF-8)
  • Code attempted to slice at byte index 2, which is inside the character
  • This confirms the same root cause: byte-based string slicing without respecting UTF-8 character boundaries

madebysmg avatar Dec 31 '25 00:12 madebysmg

byte index 22 is not a char boundary; it is inside ':' (bytes 20..23) of \nお問い合わせ:

The issue was hereE: thread '' (32236) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb\library\core\src\str\mod.rs:833:21:

TestLearningUser avatar Jan 03 '26 15:01 TestLearningUser

Same issue with Japanese text.

  • Claude Code: 2.0.76
  • macOS: Sequoia 15.7.1 (24H71)

thread '' (36751958) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21: byte index 32 is not a char boundary; it is inside '換' (bytes 30..33) of 、ジオコーディング変換) note: run with RUST_BACKTRACE=1 environment variable to display a backtrace fatal runtime error: failed to initiate panic, error 5, aborting zsh: abort claude

yoshikawa-colobiz avatar Jan 07 '26 03:01 yoshikawa-colobiz

Still occurring in v2.1.2 (latest) with Japanese text.

(Following up on my previous comment)

Environment:

  • Claude Code: 2.1.2
  • OS: macOS 14.4.1 / Darwin 23.4.0

Error:

thread '<unnamed>' (15046366) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 2 is not a char boundary; it is inside 'む' (bytes 0..3) of `む `
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
zsh: abort      claude --resume

This issue is still affecting my daily use. Would appreciate any progress on a fix. Thanks for your work on this!

takatea avatar Jan 09 '26 10:01 takatea

Hi all. I'm really sorry about this crash! I'm eager to fix it, but I'm unable to repro by trying a bunch of different patterns, languages, and file types. It'd be really helpful if folks could provide specific a file and prompt that triggers the crash from a blank slate. Please also mention which platform you're using.

As a short-term mitigation you can set environment variable CLAUDE_CODE_SYNTAX_HIGHLIGHT=off, which will avoid the codepath that triggers the panic.

Image

shawnm-anthropic avatar Jan 09 '26 16:01 shawnm-anthropic

@shawnm-anthropic

Thanks for the workaround!

I created a reproduction repository with Japanese text: https://github.com/takatea/claude-code-utf8-crash-repro

Your workaround (CLAUDE_CODE_SYNTAX_HIGHLIGHT=off) works perfectly.

The crash seems related to the number of changes — many changes crash, few changes succeed.

takatea avatar Jan 10 '26 17:01 takatea

Hi @sosukesuzuki,

We have a workaround, but the issue itself is not fixed yet. Could you tell us why this was closed?

If this was closed by mistake, please reopen it. I am waiting for this to be fixed, and I am happy to help if there is anything I can do.

Thanks.

takatea avatar Jan 12 '26 11:01 takatea

The fix is scheduled to release today. Thank you for your patience!

shawnm-anthropic avatar Jan 12 '26 16:01 shawnm-anthropic