Spurious token "court" emitted between tool calls breaks tool-call parsing and aborts the turn

Status Open
Reported on v2.1.196
Maintainer reply None cached
Activity 3 comments · opened Jun 30, 2026

What happens

The model intermittently emits a stray token (court, sometimes repeated hundreds of times) in the assistant output between tool calls. It appears where inter-tool reasoning/preamble text would normally go, and it corrupts the tool-call stream — the turn stalls or has to be interrupted manually.

Frequency / trigger

  • Reproduced repeatedly within a single long session (5+ times in a row at one point).
  • Strongly correlated with producing narration/reasoning text between consecutive tool calls. Tool calls emitted with no preamble text in front of them go through clean.
  • Partial workaround: batch tool calls together and emit no prose between them.

Impact

  • Turns abort or hang; user must interrupt manually.
  • Very disruptive in long multi-tool workflows (many sequential file edits / MCP calls).

Environment

  • Claude Code CLI: 2.1.196
  • Model: Claude Opus 4.8 (1M context) — id reported in-session as claude-opus-4-8[1m]
  • OS: Linux 6.14.x

Notes

The literal token observed was court. Possibly a tokenizer/decoding edge case or a prompt-cache interaction. User noted it seemed to start after a recent version change.

View original on GitHub ↗

3 Comments

lifedever · 2 months ago

<img width="464" height="370" alt="Image" src="https://github.com/user-attachments/assets/09ca397d-00f7-4295-ab77-29e11186faea" />

VGMVS · 2 months ago

Confirming this matches my repro exactly — thanks for the screenshot.

In my case the literal token was court; in yours it's count. Same failure shape in both: a bare word appears on its own line immediately before the <invoke ...> block, glued to the start of the tool call, and the parser then fails to find a clean start of the invocation → the turn stalls / aborts.

The strongest correlation I've found (consistent across many sessions): it fires when the assistant emits narration/reasoning text between two consecutive tool calls. Tool calls emitted with no preamble text in front of them go through clean. Batching calls together with no prose between them is a reliable workaround.

So the stray token isn't random content — it seems to be the inter-tool preamble collapsing into a single leaked token (court/count/…) that lands flush against the next <invoke>. Looks like a decoding/streaming edge at the boundary between preamble text and the tool-call block, possibly prompt-cache-related.

Repro'd many times over several days on Opus 4.8 (1M context, id claude-opus-4-8[1m]).

air-dust · 1 month ago

👍"VSCode 扩展 + 中文长会话也复现,还冒过一次乱调工具