claude-code - 💡(How to fix) Fix [Bug] Tool-use block markup intermittently corrupted with stray token prefix

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…

Fix Action

Fix / Workaround

Workarounds currently used:

  • Retry the failed call.
  • Minimize preamble text before a tool call; issue one tool at a time.
  • /compact appears to reduce frequency by shrinking context.

Code Example

[]
RAW_BUFFERClick to expand / collapse

Bug Description Title: Tool-call markup intermittently corrupted ("court" prefix) → "malformed and could not be parsed"

Summary: Tool invocations (function_calls / tool_use blocks) are intermittently emitted with corrupted markup. The block starts with a stray token (e.g. "court") instead of the proper function_calls opening tag, so the harness rejects it with "Your tool call was malformed and could not be parsed."

Symptom:

  • The same tool call, retried verbatim, usually succeeds on the next attempt.
  • Affected tools observed: Edit, Write, Bash, Read (all recovered on retry).
  • No data loss — the failure happens before the tool runs.

Conditions that seem to trigger it:

  • Long sessions with large accumulated context (multiple big tasks).
  • Emitting a tool call immediately after a long natural-language response.
  • Packing multiple tool calls into a single message.

Environment:

  • Claude Code (CLI)
  • Model: Opus 4.8 (1M context), max effort
  • Long-running session

Reproducibility:

  • Intermittent / non-deterministic. No reliable repro steps.
  • Retrying the identical call typically resolves it.
  • This session's transcript is itself a live example (please inspect the attached conversation context).

Workarounds currently used:

  • Retry the failed call.
  • Minimize preamble text before a tool call; issue one tool at a time.
  • /compact appears to reduce frequency by shrinking context.

Environment Info

  • Platform: darwin
  • Terminal: vscode
  • Version: 2.1.158
  • Feedback ID: 6b0ec702-6a20-42a7-af9a-191f3954eb42

Errors

[]

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 [Bug] Tool-use block markup intermittently corrupted with stray token prefix