Claude Code repeatedly emits malformed tool-call tags as assistant text, blocking paid workflow
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.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗