Opus 4.8 (1M): malformed tool-call markup (missing antml: prefix) cascades across retries
Environment
- Claude Code on Windows 10
- Model:
claude-opus-4-8[1m](Opus 4.8, 1M context) - Long multi-hour session
Symptom
Intermittently the model emits malformed tool-call markup: the antml: namespace prefix is dropped from invoke/parameter tags (renders as a bare <invoke name="...">), and a stray token (literally court) is prepended on the line before the function-call block. The harness then rejects it:
Your tool call was malformed and could not be parsed. Please retry.
Cascade (the main problem)
Once a single malformed call lands in the transcript, every subsequent tool call reproduces the same malformation — it appears to self-reinforce by pattern-matching on the model's own prior (broken) output. It repeated ~5 times in a row before being broken out of.
Workaround that reliably fixed it
Emitting the tool call as the very first tokens of the turn, with no preamble text, and deliberately not echoing the prior broken lines -> parses correctly.
Frequency
~5 occurrences in one session, in bursts.
Impact
Each malformed call wastes a full turn and is very confusing to the user (looks like the agent is stuck/hung).
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗