[Bug] Tool calls intermittently emitted as plain text instead of structured blocks, causing parse failures and hard hangs on retry
Bug Description
Title: Tool calls intermittently emitted as plain text ("could not be parsed"),
self-perpetuating on retry → hard hang
Environment:
- Claude Code 2.1.161 (latest), native install, WSL2 (Ubuntu 24.04) on Windows 11
- Model: Opus 4.8 (claude-opus-4-8, 1M context)
- Heavy Japanese-language sessions; many concurrent background sessions; 7 MCP servers
Description:
Intermittently the model emits tool-call markup as literal TEXT instead of a
structured tool_use block. The harness returns:
"Your tool call was malformed and could not be parsed. Please retry."
The retry frequently reproduces the same corruption, yielding:
"The model's tool call could not be parsed (retry also failed)."
which hard-stops the turn until the user manually sends another message.
Signature (from session JSONL):
A spurious token (observed literally as court) appears where the tool-call
opening delimiter should be, followed by the <invoke> markup rendered as text.
Minimal real example — an 84-character assistant message that was ENTIRELY:
court <invoke name="Bash"><parameter name="command">echo test</parameter></invoke>
This is a trivial call, so the failure is NOT correlated with payload size/content.
Frequency:
In one environment over 12 days: 87 first-attempt failures + 46 "retry also
failed" fatal stalls (~4 fatal/day). Reproduced live many times while debugging.
Impact:
Sessions appear frozen "at tool execution" for tens of minutes — worst in
background/parallel sessions that aren't actively watched, because the fatal
variant needs a manual nudge to recover.
Additional notes:
- Affects Bash/Write/Read/Edit equally; trivial calls fail too.
- Appears more often in Japanese-context turns and under high tool-call volume.
- autoUpdatesChannel=latest; confirmed present on the latest release (2.1.161).
Environment Info
- Platform: linux
- Terminal: wsl-Ubuntu-24.04
- Version: 2.1.161
- Feedback ID: 60f2e4c3-bc8b-4dcb-b55c-9ab2e4dc2098
Errors
[]This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗