[BUG] Opus 4.8 repeatedly emits malformed tool_use blocks, entire response discarded (4.7 works fine)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
On Opus 4.8 (claude-opus-4-8[1m]), when the assistant attempts to call an MCP tool, the generated tool_use JSON is frequently malformed (unterminated strings / missing braces / truncated arguments). The harness rejects the whole turn with "Your tool call was malformed and could not be parsed. Please retry."
Because text blocks and tool_use blocks are emitted in a single response, the malformed tool_use causes the accompanying text block to be discarded as well. From the user's side, the assistant appears to "go silent" — no text reaches the user even when the user explicitly says "don't use tools, just talk to me," because the model still tries to call a tool out of habit and the whole response gets thrown away again.
This blocked an active conversation for ~30 minutes across many retries. Switching the model to Opus 4.7 (claude-opus-4-7[1m]) immediately restored normal behavior with the exact same system prompt, MCP set, and conversation history.
What Should Happen?
Tool calls should either be well-formed, or — if generation fails — the accompanying text block should still be delivered to the user so the model can at least communicate.
Error Messages/Logs
Steps to Reproduce
- Use Opus 4.8 with a long-ish system prompt and multiple MCP servers attached (in my case: plugin:telegram, several claude.ai connectors).
- Hold an active conversation where most turns require calling an MCP tool (e.g. replying through a Telegram bridge).
- Within ~5–10 turns the model starts emitting malformed tool_use blocks repeatedly; "retry" does not converge.
- Switching to Opus 4.7 in the same session resolves immediately.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.156
Platform
Anthropic API
Operating System
Windows 11
Terminal/Shell
Windows Terminal
Additional Information
- Multiple MCP servers connected, including plugin:telegram and a handful of claude.ai-hosted connectors
- Long system prompt (~several KB of project-level CLAUDE.md)
- Issue is intermittent on the first few turns and then becomes near-deterministic
- Not a network/SSE hang — tokens are flowing, the response is generated and then rejected by the parser
13 Comments
Correction on environment info: the actual operating system is Windows 11 (10.0.26200), not Linux. The repro was on native PowerShell / Windows Terminal, not WSL. The "Ubuntu/Debian Linux" selection in the form was a mistake on my side.
For completeness:
我的macos上面也会出现这样的问题 并且我还有一台windows也会出现 现在我认为是模型层的问题 他不会固定发生 而是偶尔就会发生,伴随的症状就是简单的任务长时间思考 并且任务无法确定是否会完成
Adding observations from a heavy-MCP environment (Figma / Gmail / Calendar /
Drive / Playwright-CDP / Android, plus ~10 custom skills) that may extend
the failure mode described above.
Repro context:
What I observe in the broken responses (split into two patterns):
Pattern A (~70% of failures): raw XML in text block
The model emits its tool call as plain text containing the internal
<function_calls>/<invoke name=\"...\">/<parameter name=\"...\">XML,inside a regular
textcontent block, instead of as a structuredtool_useblock.
stop_reasonis still set totool_use, but the response containszero
tool_useblocks — onlythinkingandtext. This matches thesymptom in #61133 (closed) but is now reappearing in Opus 4.8.
Pattern B (~30% of failures): silent truncation
Response contains only a
thinkingblock and terminates. Notext, notool_use.stop_reasonstill reportstool_use.Possible retry-loop amplifier:
After a Pattern A failure, subsequent responses in the same session
increasingly contain broken
<function_calls>fragments appended tootherwise-normal text output (e.g. partial tags like
<functionorstray closing
>). This looks like prior malformed XML being re-fedinto context via retry annotations, which then primes the model to
emit more of the same — a latch effect. Starting a fresh session
breaks the loop; in-session retries do not.
Workaround that works for me:
immediately (do not retry in-session)
on the same prompts and tool surface)
if A/B routing (#61133) is a concern
Happy to share sanitized JSONL transcripts of both patterns if useful.
Same symptom reproducing on the claude.ai chat web/mobile app (not just Claude Code), today (June 7, 2026).
Setup: Opus 4.8, Project-external chat, long memory context (~20 user-edit entries), multiple consecutive tool calls (memory edit + web search).
Symptom: assistant response stream terminated immediately after tool calls. User saw an empty assistant turn with no text and no error message. Reproduced multiple times across consecutive tool calls in the same conversation. Repeated 500-char validation retries on the memory tool seemed to correlate with the cut-offs.
Resolution: switched to Opus 4.7 mid-conversation. Worked immediately with the same context and same tool-call patterns — confirming the model is the variable, not the environment.
Adding this as a data point that the malformed-tool-use / response-discard behavior is not Claude-Code-specific — it surfaces in Anthropic's hosted claude.ai chat surface as well, with the same workaround (pin to 4.7).
This bug is making Claude Code completely unusable for real work.
When the tool_use XML corruption occurs mid-session, there is no way to resume the interrupted task — especially for non-technical users who don't use git. The entire context is lost with no recovery path.
This isn't a minor annoyance. It breaks workflows entirely. A paying Max plan subscriber cannot rely on Opus 4.8 for any serious coding session because at any moment, hours of work can be wiped out with zero recourse.
This bug has been open and unassigned for weeks. That is unacceptable.
We need either:
Until one of these exists, Opus 4.8 is not fit for production use. Please treat this as a critical priority.
Additional note on environment:
Japanese Windows users appear to be disproportionately affected by this bug. There are numerous reports on Zenn, note, and X (Twitter) describing this as a daily occurrence — yet almost none of those users have filed English-language GitHub issues. The actual scale of impact is likely far larger than the issue count suggests.
Based on community reports, the combination of long context + multi-byte characters + multiple MCP servers significantly increases the reproduction rate on Japanese Windows environments. Please consider this as a specific reproduction condition worth investigating.
+1 from Japan (Tokyo region, Claude Max 5x, Claude Code v2.1.170, VS Code extension).
To correct a common framing in this thread: this regression did not start with 4.8. The earliest related report I can find is #62467 (2026-05-26, Opus 4.7 + extended thinking, unparseable tool_use). 4.8 made it catastrophic, but 4.7 was already showing the same failure mode under extended thinking + long context. Downgrading to 4.7 is a stopgap, not a cure.
My session log (2026-06-13):
Why this is hitting Japanese users especially hard:
The reason you're not seeing more reports from Japan is not absence of the problem — it's cultural reluctance to file English bug reports. Please don't read silence as satisfaction.
Ref:
Corroborating report — Opus 4.8 (claude-opus-4-8, pinned), reproduced 6+ times in a single session. Same malformed tool_use symptom as this issue.
Environment:
Symptom:
Trigger / non-trigger (observed):
Workarounds that held for us:
Possibly related: #60584 (court token, closed), #64314 (count token), #64235 (regression since 2026-05-29), #62344 (few-shot poisoning, closed), #66400.
I’m a Japanese macOS user and often work with non-ASCII text.
The malformed-output problem became much more frequent after I started building a library for Runic characters. I generally avoided entering Runic characters directly into prompts because they could trigger security filters, and used plain-text files when I needed to exchange actual Runic text. Even so, I observed more malformed tool calls and unexpected interruptions during that work than in any other session.
The most severe case occurred in a separate session. I started a new conversation with Fable, asked it to write a hook to mitigate the problem, and included malformed XML from an earlier session as part of the problem description. That session deteriorated rapidly. It produced substantially more malformed output and failed Multi-Edit calls than any other session I have observed. It was the strongest case of few-shot self-poisoning I have seen: once the malformed XML was present in the context, similar malformed structures appeared repeatedly and did not clear on their own within the session.
Quantitative cross-model data point (local transcript scan)
Corroborating this. I parsed
message.modelacross my local Claude Code transcripts and counted, per model: (a) assistant turns emitting ≥1tool_useblock (denominator), and (b) "malformed / could not be parsed" events attributed to the failing turn's model. Same machine, overlapping workloads, across CC 2.1.156 and 2.1.170:| model | tool-call turns | malformed | rate |
|---|---:|---:|---:|
| claude-opus-4-8 | 9,320 | 141 | ~1.5% |
| claude-opus-4-7 | 5,122 | 0 | 0 |
| claude-sonnet-4-6 | 2,288 | 0 | 0 |
| claude-fable-5 | 983 | 0 | 0 |
| claude-opus-4-6 | 241 | 0 | 0 |
stop_reason == "tool_use"but the content array contains only a (often empty)thinkingblock and notool_useblock.Happy to share the scan script if useful.
+1 — same symptom on Windows 11 + Japanese (ja-JP) locale, Claude Code Desktop v1.15962.1, model claude-opus-4-8.
Reproduction (minimal, not requiring long context or MCP):
Adding a Windows + non-English-locale data point: the regression doesn't appear to depend on macOS, MCP servers, long system prompts, or compacted sessions. Plain Agent dispatch under Opus 4.8 is enough to reproduce.
Still reproducing on the latest CLI (v2.1.181) with Opus 4.8 (1M context).
/compactmakes no difference, which is consistent with a server-side model serialization problem rather than client-side context bloat.Confirming this is NOT fixed as of v2.1.181.
Follow-up from Japan (JUN-WEBLISS, same reporter as the 2026-06-14 comment above). Adding a fresh data point where 4.8 broke a concrete real-world workflow, and a workaround pattern that survived it.
Environment
claude-opus-4-8(via/model opus[1m], 1M context)What broke
Across 133 assistant turns (all
message.model == "claude-opus-4-8"in the transcript), the harness rejected two turns outright withat
2026-07-12T15:18:13Zand2026-07-12T15:39:48Z.Two rejections in 133 turns sounds small, but they landed on the orchestration steps of a parallel-Workflow that was fanning tool calls out to multiple Sonnet subagents. Each malformed turn corrupted the batched dispatch, and the run ended before the tool-heavy extraction stage had a chance to reach measured values. The outputs it did produce were "candidate-only, unverified" — plausible-looking summaries without evidence-grounded values behind them. A later verification pass flagged material issues in that output. So this isn't just a retry-cost problem — the run can close successfully while quietly producing content that a downstream check would reject.
This is a different failure mode from the "assistant goes silent" one described in the original report and by @hiroyuki-togo / @mtskf: here the surface behaviour was "the task completed", but the outputs were shaped by degraded orchestration under repeated malformed retries.
What worked as a workaround
We rebuilt the same style-harvesting task with:
The re-run completed in 9.6 min with 0 errors, and adversarial verification against the raw scraped HTML passed on every extracted value. Empirically it looks like the Opus 4.8 tool_use malformation is proportional to how much of the tool-calling work the 4.8 model itself is doing; pushing tool-heavy work down to Sonnet subagents made the orchestrator's own malformed rate low enough to not corrupt the run.
After confirming this pattern we rolled the main loop back to
claude-opus-4-7(stable). Current session shows 13/13 assistant turns onclaude-opus-4-7and no malformed events. So the mitigation on our side is the same one @Neige-Neige documented at the top of this thread: 4.7 is still the safe default for tool-heavy sessions, more than a month after this issue was opened.Two things I'd flag for whoever is looking at this
Happy to share the parsed transcript slice (redacted) if it helps.