[BUG] Tool calls intermittently leak as plain text ("could not be parsed"), breaking multi-step work

Open 💬 0 comments Opened Jul 4, 2026 by zhaodalang

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?

What happened

The model's tool call blocks (e.g. <invoke name="Bash">...</invoke>) intermittently render as plain text in the conversation instead of being executed. The system sometimes reports "The model's tool call could not be parsed (retry also failed)". The command never runs.

Frequency / triggers

  • Intermittent — resending the same command often succeeds on the 2nd try
  • Much worse with long commands, Chinese characters, or special chars (+, quotes)
  • Short pure-English commands rarely leak
  • Happens on both Desktop app and CLI
  • Model: Opus 4.8. Persists after claude update and app restart

Impact

Makes any multi-step / iterative work (e.g. Playwright debugging) extremely painful — every step may leak and need resending. Severely degrades usability for a paid subscriber.

Environment

  • Claude Code (Desktop + CLI), macOS
  • Opus 4.8

What Should Happen?

plz fix it ! thanx a lot

Error Messages/Logs

count
<invoke name="Bash">
<parameter name="command">echo leak-check && date +%T</parameter>
<parameter name="description">Quick leak check</parameter>
</invoke>
先改 Wallet 点击方式(用定位器,最可能是坐标点击失效):

count
<invoke name="Edit">
<parameter name="file_path">/private/tmp/claude-501/-Users-woshizhutou-Claude-Projects-airdrop-hunting/6f4652b9-4f70-4b91-b17b-059cbcc3b4db/scratchpad/pw_okx_login.py</parameter>
<parameter name="old_string">        rect = page.evaluate("""() => {
            for (const el of document.querySelectorAll('button,[role=button],div')) {
                if ((el.innerText||'').trim() === 'Wallet') {
                    const r = el.getBoundingClientRect();
                    if (r.width>0 && r.height>0)
                        return {x: Math.round(r.x+r.width/2), y: Math.round(r.y+r.height/2)};
                }
            }
            return null;
        }""")
        print("[Wallet rect]", rect)
        if rect:
            page.mouse.click(rect["x"], rect["y"])
        else:
            page.mouse.click(640, 776)
        page.wait_for_timeout(6000)</parameter>
<parameter name="new_string">        # click Wallet via locator (auto-waits, dispatches real events)
        try:
            page.get_by_text("Wallet", exact=True).first.click(timeout=8000)
            print("[clicked Wallet via locator]")
        except Exception as e:
            print("[wallet click warn]", str(e)[:80])
        page.wait_for_timeout(6000)</parameter>
</invoke>

count
<invoke name="Edit">
<parameter name="file_path">/private/tmp/claude-501/-Users-woshizhutou-Claude-Projects-airdrop-hunting/6f4652b9-4f70-4b91-b17b-059cbcc3b4db/scratchpad/pw_okx_login.py</parameter>
<parameter name="old_string">        rect = page.evaluate("""() => {
            for (const el of document.querySelectorAll('button,[role=button],div')) {
                if ((el.innerText||'').trim() === 'Wallet') {
                    const r = el.getBoundingClientRect();
                    if (r.width>0 && r.height>0)
                        return {x: Math.round(r.x+r.width/2), y: Math.round(r.y+r.height/2)};
                }
            }
            return null;
        }""")
        print("[Wallet rect]", rect)
        if rect:
            page.mouse.click(rect["x"], rect["y"])
        else:
            page.mouse.click(640, 776)
        page.wait_for_timeout(6000)</parameter>
<parameter name="new_string">        try:
            page.get_by_text("Wallet", exact=True).first.click(timeout=8000)
            print("[clicked Wallet via locator]")
        except Exception as e:
            print("[wallet click warn]", str(e)[:80])
        page.wait_for_timeout(6000)</parameter>
</parameter>
</invoke>

Steps to Reproduce

the model remind me that it leaked

Claude Model

Opus

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

opus4.8

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

<img width="774" height="158" alt="Image" src="https://github.com/user-attachments/assets/0fbfb9da-f2fd-4eff-97e9-289df8379b38" />

<img width="1317" height="517" alt="Image" src="https://github.com/user-attachments/assets/9965c390-296d-4711-8a5b-2fd069e05f68" />

View original on GitHub ↗