[Bug] Opus 4.8: Tool-call XML namespace prefix dropped in long sessions, serialized as text

Open 💬 2 comments Opened Jun 16, 2026 by kil-penguin

Bug Description

Anthropic /bug report draft — tool-call XML leak (antml: namespace prefix dropped)

사용자가 Claude Code 에서 /bug 로 제출할 문안. 영어 본문 + 한국어 주석.

Title

Opus 4.8: tool_use serialization leaks as message text in long sessions (dropped antml: namespace prefix → "malformed and could not be parsed")

Body

Environment

  • Model: Opus 4.8 (claude-opus-4-8[1m])
  • Claude Code (CLI), direct Anthropic (no gateway/proxy)
  • Long-running session (multi-hour, heavy tool chaining, repeated auto-compaction)

Symptom
In a long tool-chained session, tool calls intermittently fail to execute. Instead of emitting a structured tool_use block, the model serializes the call into the text channel with the namespace prefix dropped:

<invoke name="Bash">
<parameter name="command">...</parameter>
</invoke>

instead of the correct antml:invoke / antml:parameter form. Claude Code reports Your tool call was malformed and could not be parsed. Please retry. Clean and broken calls alternate within the same session.

Trigger / aggravating factors

  • Very long sessions with heavy tool chaining and repeated auto-compaction (cumulative decode drift).
  • Recurs once decode state drifts — same session keeps reproducing.
  • Common thread: calls emitted while continuing/copying the previous successful call's shape.

Two observed signatures (likely same root defect)

  1. (2026-06-15) leak preceded by a stray course token (residue of "Of course, …").
  2. (2026-06-16) dropped antml: namespace prefix on <invoke>/<parameter>.

Impact
Each leak blocks one tool call; in agentic workflows this stalls multi-step tasks until the call is manually re-emitted.

Workaround
Re-emitting the exact same call with the full antml:invoke form recovers it each time, but drift recurs same-session; only /clear or session restart fully clears it.

Why this looks like a model-side streaming defect (not harness)

  • Reproduced on direct Anthropic with no proxy — a model-remap proxy never rewrites tool-use format.
  • Leaked tools include top-of-prompt tools (AskUserQuestion, Bash), not only deferred/ToolSearch-gated ones.
  • Nothing in CLAUDE.md / hooks / settings produces this; it is a text->tool_use channel-boundary failure mid-stream.

---

_근거: domains/knowledge/tools/claude-code/tool-call-xml-leak.md (3-harness core-sync). 2026-06-15 최초 관측 + 2026-06-16 DTP-1001/1010 측정 세션 재발._

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.177
  • Feedback ID: 2d7b038a-bc65-4a15-9b83-11d67ce00641

Errors

[]

View original on GitHub ↗

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