[BUG] Tool-use calls intermittently emitted with malformed opening tag (missing `antml:` namespace prefix) → harness rejects, tool never runs [VSCode extension, Opus 4.8 1M]

Open 💬 2 comments Opened Jul 7, 2026 by oh-soinn

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

In the Claude Code VSCode native extension, the assistant's tool_use invocations are intermittently emitted malformed: the opening tag is missing the antml: namespace prefix, so it comes out as <invoke ...> instead of the correct <invoke ...>. The harness then rejects it with "Your tool call was malformed and could not be parsed" and the tool never runs. A stray fragment from the broken tag (e.g. "court") sometimes leaks into the UI.

Very frequent and intermittent — success and failure mix within one session. It blocks Read/Grep/Bash/PowerShell/Agent calls indiscriminately, forcing manual retries and stalling multi-step work. Retrying the same call cleanly usually succeeds, which points to a generation-time tag-formatting defect rather than a content issue. It seems more likely right after long reasoning blocks / in long sessions.

What Should Happen?

Every tool_use call should be emitted with the correct antml: namespace prefix on its opening tag and execute normally, with no malformed-parse rejections.

In the Claude Code VSCode native extension, the assistant's tool_use invocations
are intermittently emitted malformed: the opening tag is missing the antml:
namespace prefix, so it comes out as <invoke ...> instead of the correct
<invoke ...>. The harness then rejects it with
"Your tool call was malformed and could not be parsed" and the tool never runs.
A stray text fragment (e.g. "court") from the broken tag sometimes leaks into the UI.

Environment

  • Claude Code: VSCode native extension
  • OS: Windows 11 Pro (10.0.26200)
  • Model: claude-opus-4-8[1m] (Opus 4.8, 1M context)

Steps / Conditions

No deterministic repro (generation-time issue). Observed correlations:

  • Very frequent, intermittent — success and failure mix within a single session.
  • More likely right after long reasoning blocks / in long sessions.
  • Affects Read/Grep/Bash/PowerShell/Agent calls indiscriminately.
  • Retrying the same call cleanly often succeeds → formatting issue, not content.

Expected

Every tool call is emitted with the correct antml: namespace prefix and executes.

Actual

Opening tag drops the antml: prefix → "malformed and could not be parsed";
tool does not run; multi-step work stalls and requires manual retries.

Impact

High. Tool execution is blocked, forcing retries and stalling multi-step tasks.
In-app reporting is also blocked: /feedback (alias /bug, /share) is
"not available in this environment", and gh can't be run due to the same bug —
hence filing here from outside the environment.

Notes

Looks like a non-deterministic generation-time tag-formatting defect (dropped XML
namespace prefix on the tool-call opening tag), not user config. Clean retry usually
recovers.

Error Messages/Logs

Harness rejection: "Your tool call was malformed and could not be parsed"
UI leak: stray fragment "court" from the broken opening tag

Steps to Reproduce

No deterministic repro — this is a non-deterministic, generation-time issue. Conditions that correlate:

  1. Use the Claude Code VSCode extension with Opus 4.8 (1M context) on a multi-step task.
  2. Have the assistant make many tool calls (Read/Grep/Bash/PowerShell/Agent), especially after long reasoning blocks in a long session.
  3. Intermittently, a tool call's opening tag drops the antml: prefix and is rejected as malformed; the tool does not run.
  4. Retrying the same call cleanly usually succeeds.

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

2.1.201 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

In-app reporting was unavailable, so this is filed manually from a browser: /feedback (aliases /bug, /share) returns "isn't available in this environment" in the VSCode extension, and gh could not be run reliably due to the same malformed-tool-call bug.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗