Opus 4.8 intermittently emits malformed tool calls: stray `count`/`call` token, then tool call without `antml:` prefix rendered as plain text
Symptom
Since 2026-06-01, Opus 4.8 intermittently breaks tool-call serialization in Claude Code. The assistant's prose ends with a stray token (count or call) on its own line, and the tool call that follows is emitted as plain text without the antml: prefix, so it is never executed:
...normal prose ending the explanation...
count
<invoke name="Bash">
<parameter name="command">...</parameter>
<parameter name="description">...</parameter>
</invoke>
The harness then injects: "Your tool call was malformed and could not be parsed. Please retry." Retries often fail the same way several times in a row, which effectively halts long agentic workflows.
Measurements (from local session transcripts, 2026-05-13 through 2026-06-11)
- 55 occurrences of raw
<invoke name=inside assistant text blocks + 14 harness "malformed" error injections, between 2026-06-01 and 2026-06-11. - Exclusively on
claude-opus-4-8. Zero occurrences on Opus 4.7 (which had heavier daily usage in May), Fable 5, Sonnet 4.6, or Haiku 4.5 over the same corpus. - Spans Claude Code v2.1.159 through v2.1.172 — not correlated with any single CLI update.
- Opus 4.8 was adopted locally on 2026-05-28; first failure observed 2026-06-01.
Pattern
- Concentrates on the first tool call immediately after a long prose block, in long-context sessions (often after auto-compaction); parallel multi-tool-call turns are rarely affected.
- Within affected sessions, every successful call uses the
antml:-prefixed form and every failure lacks the prefix.
Impact
Long-running pipelines (multi-step research/monitoring workflows) break mid-run. This is aggravated by the Fable 5 cyber-safety fallback (#67305), which auto-switches sessions onto Opus 4.8 — i.e. onto the affected model — mid-workflow.
Request
Fix the tool-call serialization regression in Opus 4.8 (or its serving/decoding path). Happy to provide raw transcript excerpts via a private channel.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗