claude-code - 💡(How to fix) Fix Claude Code repeatedly emits malformed tool-call tags as assistant text, blocking paid workflow

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…

Root Cause

However, this is only mitigation. The project cannot fully fix the issue because the malformed block never becomes a valid tool_use event, so PreToolUse/PostToolUse cannot intercept it. A platform-level fix is needed in Claude Code or the model/tool-call formatting layer.

Fix Action

Fix / Workaround

Local mitigation: The project added PR #35 with three guard layers:

  • SessionStart hook: reminds Claude that the tool-tag guard is active in every new session.
  • UserPromptSubmit hook: adds guidance when Claude Code emits a malformed-tool retry prompt.
  • Stop hook: scans the latest assistant message for malformed tool-call-like text and returns decision:block with instructions to retry using the real antml tool mechanism.

However, this is only mitigation. The project cannot fully fix the issue because the malformed block never becomes a valid tool_use event, so PreToolUse/PostToolUse cannot intercept it. A platform-level fix is needed in Claude Code or the model/tool-call formatting layer.

RAW_BUFFERClick to expand / collapse

Subject

Claude Code repeatedly emits malformed tool-call tags as assistant text, blocking paid workflow

Body

Claude Code is repeatedly emitting malformed tool-call markup as ordinary assistant text instead of valid tool_use events. Examples include count, call, court, and raw invoke / parameter blocks. These are displayed to the user as text, no tool is executed, and the workflow stops.

The user repeatedly corrected Claude with: 記法が違います。antml:invoke を使え, but Claude often emitted the same malformed markup again after the correction. Restarting the session did not resolve the recurrence.

Evidence transcript: C:\Users\2022H0843.claude\projects\C--webmap-project\f57afed8-ecf3-4607-ad4f-d37dc568cea7.jsonl

Specific evidence strings to search in the transcript:

  • count
  • invoke name=
  • 記法が違います。antml:invoke を使え
  • Your tool call was malformed and could not be parsed. Please retry.
  • The model's tool call could not be parsed (retry also failed).

Local grep counts in the above transcript (verified 2026-05-30):

  • malformed and could not be parsed: 44
  • 記法が違います: 163
  • invoke name=: 213

Codex independently re-checked the transcript and found:

  • assistant text records: 308
  • guard detections: 190
  • malformed retry prompts: 35
  • explicit guard hook messages: 0

This is causing complete work stoppage in a paid workflow. Shell/file operations do not execute, monitoring cannot proceed reliably, and the user must repeatedly perform low-level correction of Claude's tool-call syntax.

Local mitigation: The project added PR #35 with three guard layers:

  • SessionStart hook: reminds Claude that the tool-tag guard is active in every new session.
  • UserPromptSubmit hook: adds guidance when Claude Code emits a malformed-tool retry prompt.
  • Stop hook: scans the latest assistant message for malformed tool-call-like text and returns decision:block with instructions to retry using the real antml tool mechanism.

PR: https://github.com/kazusoarer/webgis-chiban/pull/35

However, this is only mitigation. The project cannot fully fix the issue because the malformed block never becomes a valid tool_use event, so PreToolUse/PostToolUse cannot intercept it. A platform-level fix is needed in Claude Code or the model/tool-call formatting layer.

Requested action: Please investigate this as a blocking Claude Code reliability bug. The desired fix is to prevent malformed tool-call-like markup from being emitted as normal assistant text, or to force regeneration/normalization before it reaches the user.

After sending:

  • Report exactly where it was sent.
  • Report whether /feedback succeeded.
  • Report whether any support ticket ID, URL, or confirmation message was returned.

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 Claude Code repeatedly emits malformed tool-call tags as assistant text, blocking paid workflow