[BUG] Single-row Bash/tool output echoed dozens of times + stray </parameter></invoke> tokens injected into result (macOS)
Summary
A Bash tool call that returned a single row of stdout was rendered in the tool result with that row duplicated ~50 times, and the result stream additionally contained stray malformed closing tokens (</parameter>, </invoke>) that were never part of the command output.
Environment
- Platform: macOS (Darwin 24.6.0)
- Model: Opus 4.8 (1M context)
- Surface: Claude Code CLI
What happened
Ran a SQL query via a wrapper script (mcp_to_cli_dms.py ... sql ...). The command genuinely produced exactly one result row:
distinct_users,total_crowds
39,1132
But the tool result rendered as the two lines distinct_users,total_crowds and 39,1132 repeated roughly 50 times in a row. Interleaved/appended into the same result block were stray tokens like:
</parameter>
</invoke>
which do not correspond to any actual stdout and look like leaked tool-invocation markup.
Expected vs actual
- Expected: tool result shows the single row once (
✓ 完成 (0.6s, 1 行)+ the one data row). - Actual: row duplicated dozens of times + injected
</parameter>/</invoke>fragments.
Impact
Pollutes context and can mislead the model into thinking output is larger/different than it is. Risk of the model fabricating/misreading results downstream.
Possibly related
- #64228 (Tool results delayed and duplicated)
- #64317 (Intermittent tool-result corruption: stale/replayed output)
- #68622 (duplicated lines after reconnect/replay)
These are tagged Linux/Windows/vscode; this report is macOS CLI and additionally involves leaked </parameter>/</invoke> markup, which I didn't see called out elsewhere.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗