[Bug] Panic: Invalid UTF-8 string indexing in core library

Resolved 💬 2 comments Opened Dec 21, 2025 by fanfeiyangcn Closed Dec 21, 2025

Bug Description
thread '<unnamed>' (2182251) panicked at /rustc/ed61e7d7e242494fb7057f2657300d9e77bb4fcb/library/core/src/str/mod.rs:833:21:
byte index 32 is not a char boundary

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 2.0.74
  • Feedback ID:

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/zed/.local/share/claude/versions/2.0.74 (expected in multi-process scenarios)\n    at XZR (/$bunfs/root/claude:2430:2165)\n    at bUA (/$bunfs/root/claude:2430:1885)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:44.008Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.049Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.050Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.075Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.075Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.077Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.080Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.080Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.106Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.108Z"},{"error":"Error: 404 {\"error\":{\"message\":\"Invalid URL (POST /v1/messages/count_tokens)\",\"localized_message\":\"\",\"type\":\"invalid_request_error\",\"param\":\"\",\"code\":\"\"}}\n    at generate (/$bunfs/root/claude:454:11203)\n    at makeRequest (/$bunfs/root/claude:801:5435)\n    at processTicksAndRejections (native:7:39)","timestamp":"2025-12-21T00:31:46.110Z"},{"error":"Error

Note: Error logs were truncated.

Full History:
(text below the image)

<img width="2862" height="1580" alt="Image" src="https://github.com/user-attachments/assets/a358c0a1-33bd-458c-a9ee-759147566336" />

31 ### The Dumb Zone(愚蠢区)
32
33 -然后呢,还有一个,就是一个学术的一个名词,就是就是经过很多这个研究,就是发现的一个一个一个一个东西,就是如果你的context window用了40%之后呢,它的效果就会开始明显的下降,比如说他这里如果
-以cos为例的话。
33 +然后呢,还有一个,就是一个学术的一个名词,就是就是经过很多这个研究,就是发现的一个一个一个一个东西,就是如果你的 Context Window 用了 40% 之后呢,它的效果就会开始明显的下降,比如说他这里
+如果以 Claude 为例的话。
34
35 -他总共是200k的tokens, 我会有32k的这个tokens会保留,预留出来,所以他就剩只剩下16618k的to ken, 是吧?这一块它的40%的context使用上面还是还是挺聪明的,但是下面的话就变成一个叫当做就变成一个
-变得很蠢。就是如果他也提到如果你的mcp太太多的话,就会去挤满你的这一个上下文,所以不要安装太多ftp two的这个原因,加格基本上上完之后就直接直接直接到了这个预存区,那就那个效果是非常差,所
-以呢。
35 +他总共是 200K 的 tokens,会有 32K 的这个 tokens 会保留,预留出来,所以他就剩只剩下 168K 的 tokens,是吧?这一块它的 40% 的 context 使用上面还是还是挺聪明的,但是下面的话就变成一个叫 Dum
+b Zone 就变成一个变得很蠢。就是如果他也提到如果你的 MCP Tools 太太多的话,就会去挤满你的这一个上下文,所以不要安装太多 MCP Tools 的这个原因,加完基本上上完之后就直接直接直接到了这个愚蠢
+区,那就那个效果是非常差,所以呢。
36
37 ---
38

⏺ Section 4: 使用 AI 的几种方式

⏺ Update(ai-sharing/sharing-dir/cxt_eng_and_sdd_transcript.md)

✻ Correcting spelling and recognition errors… (esc to interrupt · ctrl+t to hide todos · 2m 14s · ↓ 2.1k tokens · thought for 3s)
⎿  ☒ Separate transcript by sections matching the slide structure
☐ Correct spelling and voice recognition mistakes section by section
☐ Add images to the transcript to make it an article
☐ Review and finalize the article

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
writing | Ctx(u): 38.0% ⧉ In cxt_eng_and_sdd_transcript.md
⎇ main
(+8,-8) | 𖠰 main | v2.0.74
Model: Opus 4.5 | Session: 31m
00314a2c-516c-4c80-89cb-8e8fc2cada8c
⏵⏵ bypass permissions on (shift+tab to cycle)

thread '<unnamed>' (2182251) 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 方式其实鼓励这种做法的,他request 的使用量,但我不知道以前现实,最近更新没有,至少今天看还是这样,它的国籍就是你,你一次跟他对话,他就算一次request,如果你新开一次一轮对话的话。
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5, aborting
[1] 13880 abort claude --dangerously-skip-permissions -r

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗