Malformed tool calls: stray 'court' token + dropped antml namespace prefix on tags

Open 💬 6 comments Opened Jun 16, 2026 by systemNEO

Summary

In long sessions, the model intermittently emits a malformed tool call: the block starts with a stray token court and the tags are written without the antml: namespace prefix (<invoke> / <parameter> instead of the namespaced form). The result is unparseable and the call is rejected with "the tool call was malformed and could not be parsed", aborting the action.

It happened roughly 10 times in a single session. Correctly formatted calls (with the namespace prefix) work fine in between, so the model is clearly capable of the right format — it just keeps regressing to the broken one.

What I observed

A failing tool call looked like this (note the leading court token and the missing namespace prefix on the tags):

court
<invoke name="Bash">
<parameter name="command">cd /home/hpb/projects/camping
for f in docker-compose.yml docker-compose.staging.yml docker-compose.production.yml; do
  echo "=== $f ==="
  grep -cE 'BOOKING_DOMAIN_BASE:' "$f"
done</parameter>
<parameter name="description">...</parameter>
</invoke>

The correct form (which works) is the same block but starting directly with the namespaced invoke tag and using the namespaced parameter tag for every parameter, with no leading court token.

Impact

  • Each occurrence aborts the tool call; the user has to point out the error and the model retries.
  • Once it starts, it tends to recur within the same session even after being corrected multiple times — it cost a long working session and required pausing the work.

Environment

  • Model: Opus 4.8 (claude-opus-4-8)
  • Claude Code CLI, long session (many sequential tool calls, large context)
  • Tools affected: at least Bash and Edit (an immediately-preceding Write call in the same turn succeeded with the correct prefix)

Expected

The model should always emit the namespaced tool-call tags and never prepend a stray token such as court.

Notes

  • The failures cluster later in a long session; earlier in the same session the format is consistently correct.
  • Once it starts, repeated retries frequently reproduce the same court + non-namespaced-tag pattern.

View original on GitHub ↗

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