Tool calls intermittently emitted as plain text (stray `court` + legacy `<invoke>` XML) instead of executing — hangs the session
Summary
Intermittently, instead of issuing a real tool call, Claude Code emits the tool call as plain text in the assistant message: a stray token court followed by the legacy XML-style <invoke name="..."> / <parameter name="..."> markup. When this happens the tool does not execute and the turn hangs (no tool result is ever returned). Re-emitting the same call cleanly almost always works.
Environment
- Claude Code: 2.1.183
- Model: Opus 4.8 (
claude-opus-4-8) - OS: Linux on WSL2 (Windows) —
6.6.87.2-microsoft-standard-WSL2, x86_64 - Node: v20.19.5
- MCP: Playwright MCP (the affected calls were MCP tools)
What happens
The assistant output contains literal text like:
court
<invoke name="mcp__playwright__browser_navigate">
<parameter name="url">https://example.com/...</parameter>
</invoke>
instead of an actual function call. No tool runs and the session appears frozen until the user points it out, at which point re-emitting the call works.
Affected tools (observed)
mcp__playwright__browser_navigatemcp__playwright__browser_evaluate
Both are MCP tools. It happened 8+ times across a single long session, more often on browser_navigate.
Frequency / pattern
- Intermittent, non-deterministic. The same call re-emitted immediately usually executes fine.
- Seemed more likely on longer
browser_evaluateblocks and on navigation calls. - The leading stray token was consistently
court.
Expected behavior
Tool calls should always be emitted in the proper function-call format and execute; they should never be rendered as literal <invoke>/<parameter> text.
Workarounds found
- Re-emitting the identical call immediately usually succeeds.
- For navigation, using
browser_evaluatewithwindow.location.href = '<url>'was more reliable thanbrowser_navigate(though the leak still occasionally appeared on evaluate too).
Impact
Repeated hangs in long agentic / browser-automation sessions, requiring manual user intervention to recover.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗