openclaw - 💡(How to fix) Fix Message duplication: agent runner retries full turns on tool errors, resending text to user

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…

When a tool call fails with an error (e.g., "guildId required" on Discord message send, or "node not connected"), the agent runner retries the entire turn. Since the model generates both text output AND a tool call in the same turn, the text gets delivered to the user again on each retry. This results in 7-10+ identical messages per user input.

Error Message

When a tool call fails with an error (e.g., "guildId required" on Discord message send, or "node not connected"), the agent runner retries the entire turn. Since the model generates both text output AND a tool call in the same turn, the text gets delivered to the user again on each retry. This results in 7-10+ identical messages per user input.

  • The file has transient error detection for HTTP errors (429, 5xx, quota) via TRANSIENT_ERROR_DETAIL_HINT_RE
  • The agent should either: (a) abort the turn and report the error, or (b) skip the failed tool and deliver the text response once

Root Cause

In agent-runner.runtime-CTlghBhJ.js:

  • The file has transient error detection for HTTP errors (429, 5xx, quota) via TRANSIENT_ERROR_DETAIL_HINT_RE
  • But there is no dedup logic or max-turn limit for repeated tool failures
  • Terminal tool errors like "guildId required" or "node not connected" are retried immediately with no backoff or abort
  • Each retry regenerates the full assistant response (text + tool call), and the text is sent to the user before the tool executes and fails again

Fix Action

Workaround

None found. The only mitigation is restarting the gateway session.

RAW_BUFFERClick to expand / collapse

Bug: Duplicate messages sent to user on tool errors

Description

When a tool call fails with an error (e.g., "guildId required" on Discord message send, or "node not connected"), the agent runner retries the entire turn. Since the model generates both text output AND a tool call in the same turn, the text gets delivered to the user again on each retry. This results in 7-10+ identical messages per user input.

Root Cause

In agent-runner.runtime-CTlghBhJ.js:

  • The file has transient error detection for HTTP errors (429, 5xx, quota) via TRANSIENT_ERROR_DETAIL_HINT_RE
  • But there is no dedup logic or max-turn limit for repeated tool failures
  • Terminal tool errors like "guildId required" or "node not connected" are retried immediately with no backoff or abort
  • Each retry regenerates the full assistant response (text + tool call), and the text is sent to the user before the tool executes and fails again

Impact

  • User receives 7-10+ identical messages per interaction
  • Token/quota exhaustion across all configured providers (each retry burns tokens)
  • Ledger/DB systems receiving duplicate insertions
  • Poor UX, especially in chat channels (Discord, Telegram)

Expected Behavior

  • Terminal tool errors (config errors like "guildId required", "node not connected") should NOT trigger a full turn retry
  • The agent should either: (a) abort the turn and report the error, or (b) skip the failed tool and deliver the text response once
  • A max-retry count for identical tool failures would prevent infinite loops

Environment

  • OpenClaw v2026.4.15
  • Node.js v24.14.1
  • Channel: Discord
  • Primary model: zai/glm-5.1 with fallback chain

Workaround

None found. The only mitigation is restarting the gateway session.

extent analysis

TL;DR

Implement deduplication logic or a max-turn limit for repeated tool failures to prevent duplicate messages from being sent to the user.

Guidance

  • Identify and handle terminal tool errors (e.g., "guildId required", "node not connected") separately from transient errors to prevent retries.
  • Consider implementing a retry count limit or exponential backoff for tool failures to prevent infinite loops.
  • Modify the agent runner to skip the failed tool and deliver the text response only once, instead of regenerating the full response on each retry.
  • Review the TRANSIENT_ERROR_DETAIL_HINT_RE pattern in agent-runner.runtime-CTlghBhJ.js to ensure it correctly handles terminal tool errors.

Example

No code snippet is provided as the issue does not contain sufficient code context.

Notes

The provided information suggests that the issue is specific to the agent runner and tool error handling. The solution may require modifications to the agent-runner.runtime-CTlghBhJ.js file or the underlying logic for handling tool failures.

Recommendation

Apply a workaround by modifying the agent runner to handle terminal tool errors and implement a retry count limit or exponential backoff, as upgrading to a fixed version is not mentioned in the issue.

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

openclaw - 💡(How to fix) Fix Message duplication: agent runner retries full turns on tool errors, resending text to user