Opus 4.8 intermittently emits tool calls as literal text ('court'/'count' + raw invoke tags), turn ends without executing

Open 💬 1 comment Opened Jul 4, 2026 by hiroponne

Summary

On Opus 4.8, tool-call blocks are intermittently emitted as literal text instead of being parsed as tool_use blocks. The output looks like a short corrupted opener word (court, count, course, or call) followed by the raw tags, e.g.:

court
<invoke name="Read">
<parameter name="file_path">/path/to/file.md</parameter>
<parameter name="offset">340</parameter>
<parameter name="limit">130</parameter>
</invoke>

No tool executes, the assistant turn ends with a text-only message, and the session sits idle until the user notices and nudges it.

Measured data (from local transcripts, ~/.claude/projects, May–July 2026)

Scanned all session transcripts with a script (assistant text blocks containing <invoke name=, grouped by API message id; legitimate quotations inside code fences/backticks excluded):

| Model | Corrupted messages / total assistant messages | Rate |
|---|---|---|
| claude-opus-4-8 | 113 / 6,400 | 1.77% |
| claude-opus-4-7 | 4 / 2,868 | 0.14% |
| claude-fable-5 | 0 / 1,407 | 0% |
| claude-sonnet-5 / 4-6 | 0 / 349 | 0% |

Additional observations:

  • Opener token varies: court (119 blocks), count (26), course (9), call (1) — looks like the tool-call start token being decoded as a similar text token.
  • Every corrupted API message is text-only (0 of 118 corrupted messages also contained a tool_use block), so the turn always ends without executing anything.
  • History contamination: once a corrupted block is in the conversation, the next assistant message is corrupted again in ~33% of cases (39 of 118). Worst case: 75 corrupted blocks in a single session (2026-06-24). /compact clears the loop.
  • Trigger correlation: 83% of corrupted blocks were immediately preceded by a short prose preamble in the same message ("I'll check X now." → tool call), but 17% occurred with no preamble, so prompt-side workarounds only reduce the rate.
  • Affects many tools (observed on Edit 79 / Bash 42 / Read 30 / Workflow 5 / Agent, WebSearch, TaskUpdate, AskUserQuestion).
  • All usage was usage.speed: "standard" (no fast-mode data).
  • Subagent transcripts (57 files, including 124 Opus 4.8 messages) show no confirmed occurrence — observed only in main-thread conversations, which tend to have much longer contexts.

Impact

The session stalls silently (turn ends, nothing runs). Users lose time until they notice. Contaminated history raises recurrence, compounding the problem in long sessions.

Workaround in use

A Stop hook that detects raw <invoke name= + <parameter structure (outside code fences) in the final assistant message and returns {"decision":"block"} with a retry instruction, escalating to a /compact suggestion after 3 consecutive failures. Works because corrupted turns are always text-only, but it is recovery, not prevention.

Environment

  • Claude Code on macOS (darwin 25.2.0), Max plan, 1M context enabled
  • Models as listed above; corruption is overwhelmingly claude-opus-4-8

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗