openclaw - 💡(How to fix) Fix Provider quota/rate-limit errors should trigger model fallback chain, not crash the session [1 participants]

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…
GitHub stats
openclaw/openclaw#59861Fetched 2026-04-08 02:39:42
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

When a model provider returns a quota/rate-limit error (e.g., Ollama Cloud weekly usage cap at 100%), OpenClaw throws a LiveSessionModelSwitchError and kills the session instead of cascading to the next model in the agent's configured fallback chain.

Error Message

LiveSessionModelSwitchError: Live session model switch requested: ollama/qwen3.5:cloud

Root Cause

When a model provider returns a quota/rate-limit error (e.g., Ollama Cloud weekly usage cap at 100%), OpenClaw throws a LiveSessionModelSwitchError and kills the session instead of cascading to the next model in the agent's configured fallback chain.

Code Example

{
  "primary": "ollama/qwen3.5:cloud",
  "fallbacks": ["openrouter/xiaomi/mimo-v2-pro", "ollama/kimi-k2.5:cloud"]
}

---

LiveSessionModelSwitchError: Live session model switch requested: ollama/qwen3.5:cloud
RAW_BUFFERClick to expand / collapse

Bug Report

Environment

  • OpenClaw version: latest (as of 2026-04-02)
  • OS: macOS (Darwin 25.3.0, x64)
  • Node: v22.22.0

Description

When a model provider returns a quota/rate-limit error (e.g., Ollama Cloud weekly usage cap at 100%), OpenClaw throws a LiveSessionModelSwitchError and kills the session instead of cascading to the next model in the agent's configured fallback chain.

Agent Config (example)

{
  "primary": "ollama/qwen3.5:cloud",
  "fallbacks": ["openrouter/xiaomi/mimo-v2-pro", "ollama/kimi-k2.5:cloud"]
}

Expected Behavior

When ollama/qwen3.5:cloud returns a quota exceeded error, OpenClaw should:

  1. Recognize this as a retryable/fallback-eligible error
  2. Automatically try the next model in the fallback chain (openrouter/xiaomi/mimo-v2-pro)
  3. Continue the session on the fallback model

Actual Behavior

OpenClaw throws:

LiveSessionModelSwitchError: Live session model switch requested: ollama/qwen3.5:cloud

The session dies. No fallback is attempted.

Impact

This affected 26+ heartbeat cron jobs across all branches simultaneously when the Ollama Cloud weekly quota was hit. Every agent with ollama/qwen3.5:cloud as primary went offline, despite having openrouter/xiaomi/mimo-v2-pro as a perfectly healthy fallback.

The error also occurs on cron-initiated sessions where the cron specifies a different model (e.g., openrouter/xiaomi/mimo-v2-pro) but the agent's configured primary is ollama/qwen3.5:cloud. The session initializes on the cron model, then crashes when the agent tries to switch to its primary.

Additional Context

  • The LiveSessionModelSwitchError appears to be a model negotiation issue between cron session model and agent primary model
  • Both ollama/qwen3.5:cloud and ollama/kimi-k2.5:cloud share the same Ollama Cloud quota, so both die simultaneously
  • Agents on openrouter/* or anthropic/* primaries were unaffected
  • These same cron jobs worked fine for hundreds of cycles before the quota was hit

Suggested Fix

  • Treat provider quota/rate-limit errors (HTTP 429, quota exceeded responses) as fallback-eligible
  • When a model switch fails due to provider unavailability, try the fallback chain before throwing LiveSessionModelSwitchError
  • Consider making the cron session model vs agent primary model negotiation more graceful — if the cron model works, don't force a switch to the agent primary

extent analysis

TL;DR

Modify OpenClaw to treat provider quota/rate-limit errors as fallback-eligible and attempt to switch to the next model in the fallback chain before throwing a LiveSessionModelSwitchError.

Guidance

  • Review the error handling logic for LiveSessionModelSwitchError to ensure it correctly identifies and handles quota/rate-limit errors (e.g., HTTP 429) as retryable/fallback-eligible errors.
  • Update the model switching mechanism to attempt a fallback to the next model in the chain when a switch fails due to a provider quota/rate-limit error.
  • Consider implementing a more graceful negotiation between the cron session model and the agent primary model to prevent unnecessary model switches when the cron model is functional.

Example

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

Notes

The suggested fix assumes that the LiveSessionModelSwitchError is thrown due to the model switch failure caused by the quota/rate-limit error. However, the actual implementation details of OpenClaw's error handling and model switching mechanisms are not provided, so the suggested fix may need to be adapted to the specific implementation.

Recommendation

Apply a workaround by treating provider quota/rate-limit errors as fallback-eligible and attempting to switch to the next model in the fallback chain before throwing a LiveSessionModelSwitchError, as this approach addresses the root cause of the issue and prevents unnecessary session terminations.

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