claude-opus-4-8: malformed tool-call wrapper (raw <invoke> XML leaks as text, tool call fails) + off-topic/hallucinated replies since ~2026-06-26

Open 💬 4 comments Opened Jun 28, 2026 by chengchangli

Environment

  • Claude Code desktop app (entrypoint claude-desktop), updated to latest; bundled claude-code 2.1.187. Bug persists after updating.
  • Windows 11 (10.0.26200)
  • Model: claude-opus-4-8 (used in all sessions)
  • Endpoint: https://api.anthropic.com (official, no proxy)
  • Reasoning effort: high (extended thinking on)

Summary

Since ~2026-06-26/27, claude-opus-4-8 intermittently produces two coupled failures:

  1. Malformed tool calls. Instead of a structured tool_use block, output is stored as a single plain text block containing raw tool-call XML (a stray token court followed by <invoke name="..."><parameter ...>...</invoke>). No tool_use block is produced, so the client has nothing to execute → the tool call fails and the raw XML is shown verbatim in the conversation.
  2. Off-topic / hallucinated replies including content the user never said (context confusion).

Evidence (session transcript .jsonl)

  • Leaking assistant message: stop_reason = "tool_use" but message.content is a single text block with NO tool_use block; text contains literal `court

<invoke name="Write">...</invoke>. model = claude-opus-4-8`.

  • The wrapper that should be <function_calls> appears corrupted as court.

Onset & frequency

  • Clean before ~06-26 (only one occurrence on 06-17, in an extreme 13,410-line / 1,539-thinking-block session).
  • Frequent on 06-27 and 06-28, including moderate sessions (~1,100–1,400 lines). Intermittent within a session; worse in longer/heavier sessions and with large tool payloads (Write/Workflow content).

Ruled out

  • Client version: updating the desktop app to latest did NOT fix it.
  • User config: settings.json clean (no hooks, output styles, or injected system prompt).
  • Project/data: no <invoke> text anywhere in the repo; local headless claude -p executes tools normally.

Workaround

  • Switching the model from Opus 4.8 → Opus 4.7 (same session, same machine) immediately restores correct tool execution AND coherent on-topic replies. Strongly indicates a claude-opus-4-8 server-side regression.

Impact

Severe: tool calls fail and work is blocked; off-topic replies waste turns. Had to abandon Opus 4.8 and fall back to 4.7.

View original on GitHub ↗

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