Tool call intermittently emitted as malformed plaintext ('court') instead of executing
Summary
Intermittently, a tool/function call is not executed and is instead emitted as malformed plaintext in the assistant's visible message. The opening of the tool-invocation block is corrupted into the literal string court (apparently a garbled function-call opening tag), and the call's parameters then leak into the rendered message as ordinary text. No tool runs, so the turn silently does nothing and the user sees raw output such as:
court
select:mcp__hydlogger__task_create,mcp__hydlogger__task_update,mcp__hydlogger__task_list
3
Environment
- Claude Code CLI (terminal)
- Model: Claude Opus 4.x
- Long-running session with MCP servers configured (stdio); frequent use of deferred MCP tools loaded via tool search
- Session had been resumed several times (
/exitthen relaunch) during the work
Expected
The intended tool invocation (e.g. loading a tool schema via tool-search, a git commit via the shell tool, or a file Write) executes as a normal structured tool call.
Actual
The tool-invocation block is rendered as plaintext. The first token of the block is the word court instead of the proper opening tag, after which the arguments (a query string + number, a heredoc commit body, or file contents) appear as literal chat text. The tool does not run.
Frequency
Observed 4 times in a single session. Notably, while trying to file this very report, the Write call that created the issue body was itself corrupted the same way and did not execute.
Pattern noticed (not a confirmed root cause):
- Occurs right after a short natural-language preamble immediately followed by a tool call.
- Tends to hit larger or batched calls (a multi-tool batch, a
git commit -m "$(cat <<'EOF' ... EOF)"heredoc, a multi-lineWrite). - The corruption replaces the invocation opening tag with the string
court; subsequent parameters spill into the message as text.
Impact
- The intended action silently does not execute (no tool call is made).
- Raw, confusing output is shown to the user.
- In agentic/multi-step flows this breaks work midway and requires manual re-prompting. Re-issuing the same call on the next turn worked each time (so it appears intermittent, not a hard/deterministic failure).
Repro notes
No deterministic minimal repro. Appears to be an intermittent generation/serialization glitch in how the tool-call block is emitted, more likely on larger/batched calls that follow inline prose. Happy to provide approximate token counts or surrounding-turn context if useful for triage.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗