Stray "court" token emitted immediately before tool-use <invoke> tag corrupts the tool call (Opus 4.8, Claude Code 2.1.158)

Resolved 💬 2 comments Opened Jun 2, 2026 by nahanaha Closed Jun 5, 2026

Environment

  • Claude Code: 2.1.158
  • Model: claude-opus-4-8 (1M context)
  • OS: Windows 11 Pro, PowerShell 7

Symptom

Immediately before emitting a tool-use opening tag (<invoke name="...">), the assistant emits a stray literal token court. This corrupts the tool call: (1) the tool does not execute and the turn appears to hang, and (2) the raw broken tool-call XML is rendered to the user instead of being parsed.

Observed example:

court
<invoke name="Edit"> ... </invoke>

Triggers

  • Occurs when a long assistant text block is immediately followed by a tool call in the same turn.
  • Also occurs when the tool input is long (e.g. a long Write/Edit content). In one case a long Write failed on the first attempt (court-corrupted) and succeeded on retry.
  • Does NOT occur on short replies.

Frequency

11 occurrences in a single session on 2026-06-01.

Impact

Interactive sessions are recoverable by retry, but unattended scheduled/remote runs can hang silently with no human watching.

Possibly related

#61133 (Opus tool calls failing to parse since ~2026-05-20, correlated with a server-side model variant change).

Request

Please confirm whether this is known server-side model behavior and whether a fix or mitigation (env var / setting) exists.

View original on GitHub ↗

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