claude-code - 💡(How to fix) Fix Tool calls intermittently emitted as literal text (stray 'court' + raw <invoke>) instead of executing — mostly Edit/Read (Opus, CLI)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

In a long Claude Code CLI session (Opus, large-context), the agent intermittently emitted tool calls as literal text in the transcript instead of executing them. The leaked text is prefixed with a stray court token followed by the raw function-call XML, e.g.:

court
<invoke name="Edit">
<parameter name="file_path">/path/to/file</parameter>
<parameter name="old_string">...</parameter>
<parameter name="new_string">...</parameter>
</invoke>

Instead of the Edit (or Read) being dispatched, the <invoke>…</invoke> block rendered verbatim in chat. The stray leading court token is the consistent signature.

Error Message

serialization/tokenization corruption rather than a tool-side error (the tools

Root Cause

In a long Claude Code CLI session (Opus, large-context), the agent intermittently emitted tool calls as literal text in the transcript instead of executing them. The leaked text is prefixed with a stray court token followed by the raw function-call XML, e.g.:

court
<invoke name="Edit">
<parameter name="file_path">/path/to/file</parameter>
<parameter name="old_string">...</parameter>
<parameter name="new_string">...</parameter>
</invoke>

Instead of the Edit (or Read) being dispatched, the <invoke>…</invoke> block rendered verbatim in chat. The stray leading court token is the consistent signature.

Fix Action

Fix / Workaround

Instead of the Edit (or Read) being dispatched, the <invoke>…</invoke> block rendered verbatim in chat. The stray leading court token is the consistent signature.

Code Example

court
<invoke name="Edit">
<parameter name="file_path">/path/to/file</parameter>
<parameter name="old_string">...</parameter>
<parameter name="new_string">...</parameter>
</invoke>
RAW_BUFFERClick to expand / collapse

Summary

In a long Claude Code CLI session (Opus, large-context), the agent intermittently emitted tool calls as literal text in the transcript instead of executing them. The leaked text is prefixed with a stray court token followed by the raw function-call XML, e.g.:

court
<invoke name="Edit">
<parameter name="file_path">/path/to/file</parameter>
<parameter name="old_string">...</parameter>
<parameter name="new_string">...</parameter>
</invoke>

Instead of the Edit (or Read) being dispatched, the <invoke>…</invoke> block rendered verbatim in chat. The stray leading court token is the consistent signature.

Frequency / pattern

  • Happened ~6+ times across one session.
  • Almost exclusively on Edit and Read tool calls. Bash calls were unaffected.
  • Sometimes the underlying tool still executed despite the leaked text; other times the turn was wasted and the call had to be re-issued.

Impact

  • Heavy transcript noise and operator confusion.
  • Wasted turns re-issuing calls.
  • Looks like the agent is malfunctioning mid-task.

Environment

  • Surface: Claude Code CLI
  • Model: Opus (large-context)
  • OS: macOS

Notes

The court-prefixed raw <invoke> strongly suggests a function-call serialization/tokenization corruption rather than a tool-side error (the tools themselves work when the call is well-formed). Filing for visibility; happy to provide more redacted transcript context if useful.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Tool calls intermittently emitted as literal text (stray 'court' + raw <invoke>) instead of executing — mostly Edit/Read (Opus, CLI)