-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
[Bug]: Fallback should trigger on provider upstream_error / LLM request failed #95519
Copy link
Copy link
Closed
Closed
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.bugSomething isn't workingSomething isn't workingbug:behaviorIncorrect behavior without a crashIncorrect behavior without a crashclawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:auth-providerAuth, provider routing, model choice, or SecretRef resolution may break.Auth, provider routing, model choice, or SecretRef resolution may break.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.Channel message delivery can be lost, duplicated, or misrouted.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.no-staleExclude from stale automationExclude from stale automation
Type
Fields
Priority
None yet
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
When the primary provider returns an upstream_error, OpenClaw ends the turn with LLM request failed instead of trying the configured fallback models.
Steps to reproduce
agents.defaults.model.primaryand fallback models underagents.defaults.model.fallbacks.type: "upstream_error"and messageUpstream request failed.LLM request failed, only the primary provider/model appears in the trajectory, and no fallback candidate is attempted.Expected behavior
If fallback models are configured, provider-side transient errors such as
upstream_error/LLM request failedshould be treated as fallbackable failures.OpenClaw should continue to the next configured fallback model before ending the turn as failed. The trajectory should record a fallback step for the failed primary candidate. If all candidates fail, the final error should summarize all attempted models. Non-transient or intentional errors should keep their current behavior.
Actual behavior
The primary provider returned an error shaped like:
{ "error": { "message": "Upstream request failed", "type": "upstream_error", "param": "", "code": null } }OpenClaw recorded the run as failed with
stopReason: "error",terminalError: "non_deliverable_terminal_turn", and the user-facing errorLLM request failed.The turn ended immediately on the primary model. The trajectory/logs show only the primary provider/model, no
model.fallback_stepevents, and no fallback provider/model.OpenClaw version
2026.6.8 (Git SHA from trajectory metadata: 685aa7f)
Operating system
Gateway / embedded agent runtime; OS not shown in the provided trajectory metadata
Install method
gateway / embedded agent
Model
Primary model configured under agents.defaults.model.primary; fallbacks configured under agents.defaults.model.fallbacks
Provider / routing chain
OpenClaw gateway / embedded agent -> primary configured provider/model; fallback providers/models from agents.defaults.model.fallbacks
Additional provider/model setup details
Fallbacks are configured under
agents.defaults.model.fallbacks.Example redacted config shape:
{ "agents": { "defaults": { "model": { "primary": "provider-a/model-a", "fallbacks": [ "provider-b/model-b", "provider-c/model-c", "provider-d/model-d" ] } } } }No API keys, tokens, or provider credentials are included here.
Logs, screenshots, and evidence
Impact and severity
Affected users/systems/channels: gateway / embedded agent users who configure fallback models under
agents.defaults.model.fallbacks.Severity: High for this failure mode because a configured fallback chain is skipped and the user receives a failed turn.
Frequency: Observed for the provider-side
upstream_error/ user-facingLLM request failedcase described above.Consequence: Transient upstream provider failures still end the turn immediately even when healthy fallback models are configured.
Additional information
Likely area: the embedded run result fallback classification appears to handle empty visible assistant replies, reasoning-only output, planning-only output, and incomplete/format-like terminal responses, but provider-side error payloads such as
upstream_errorappear to be returned as final error results instead of being classified as fallbackable.Suggested acceptance criteria:
agents.defaults.model.fallbacksconfigured, a primary model response containingtype: "upstream_error"triggers the next fallback candidate.Related but distinct issues shown by GitHub's duplicate detector:
fallbackConfiguredwas false.This report is specifically about OpenClaw 2026.6.8 with fallbacks configured, where a provider-side
upstream_error/LLM request failedis surfaced as a final error instead of triggering the configured fallback chain.