openclaw - 💡(How to fix) Fix v2026.3.28: Rate-limited primary model causes LiveSessionModelSwitchError cascade, fallbacks never used [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#59252Fetched 2026-04-08 02:26:54
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

When the primary model for an agent hits a rate limit (429), the fallback chain fails to engage properly. Instead, the session enters a loop where it repeatedly tries the primary model, interleaving with brief fallback candidate attempts that immediately fail with LiveSessionModelSwitchError.

Error Message

[model-fallback/decision] candidate_failed requested=google/gemini-3-flash-preview candidate=anthropic/claude-haiku-4-5 reason=unknown [agent/embedded] live session model switch detected: anthropic/claude-haiku-4-5 -> google/gemini-3-flash-preview [openai-compat] chat completion failed: LiveSessionModelSwitchError: Live session model switch requested

Root Cause

When the primary model for an agent hits a rate limit (429), the fallback chain fails to engage properly. Instead, the session enters a loop where it repeatedly tries the primary model, interleaving with brief fallback candidate attempts that immediately fail with LiveSessionModelSwitchError.

Fix Action

Workaround

Switch the primary model to a paid model (e.g., anthropic/claude-haiku-4-5) so the primary never hits free-tier rate limits. Fallbacks then work normally.

Code Example

[model-fallback/decision] candidate_failed requested=google/gemini-3-flash-preview candidate=anthropic/claude-haiku-4-5 reason=unknown
[agent/embedded] live session model switch detected: anthropic/claude-haiku-4-5 -> google/gemini-3-flash-preview
[openai-compat] chat completion failed: LiveSessionModelSwitchError: Live session model switch requested
RAW_BUFFERClick to expand / collapse

Description

When the primary model for an agent hits a rate limit (429), the fallback chain fails to engage properly. Instead, the session enters a loop where it repeatedly tries the primary model, interleaving with brief fallback candidate attempts that immediately fail with LiveSessionModelSwitchError.

Steps to Reproduce

  1. Configure an agent with google/gemini-3-flash-preview as primary and multiple fallbacks (e.g., anthropic/claude-haiku-4-5, groq/llama-3.3-70b-versatile)
  2. Exhaust the Gemini free tier daily quota (429 "RESOURCE_EXHAUSTED")
  3. Send a request via /v1/chat/completions HTTP endpoint

Expected Behavior

The fallback chain should engage: after Gemini fails with 429, the next fallback (Haiku) should be tried and succeed.

Actual Behavior

The session enters a loop:

[model-fallback/decision] candidate_failed requested=google/gemini-3-flash-preview candidate=anthropic/claude-haiku-4-5 reason=unknown
[agent/embedded] live session model switch detected: anthropic/claude-haiku-4-5 -> google/gemini-3-flash-preview
[openai-compat] chat completion failed: LiveSessionModelSwitchError: Live session model switch requested

Every fallback candidate is immediately marked candidate_failed reason=unknown and the session switches back to the rate-limited primary. The entire fallback chain cycles through without any candidate actually being attempted.

Workaround

Switch the primary model to a paid model (e.g., anthropic/claude-haiku-4-5) so the primary never hits free-tier rate limits. Fallbacks then work normally.

Environment

  • OpenClaw v2026.3.28
  • Docker (ghcr.io/openclaw/openclaw:latest)
  • Token auth mode
  • HTTP /v1/chat/completions endpoint
  • 13 fallback models configured

Additional Context

  • This only affects the HTTP API endpoint. The same agent works fine via Telegram (which may use a different session lifecycle).
  • Restarting the container does not fix it if the primary model is still rate-limited.
  • The reason=unknown on fallback candidates suggests the candidates aren't actually being sent to the provider — they're being rejected before the API call.

extent analysis

TL;DR

The most likely fix is to modify the fallback chain engagement logic to properly handle rate-limited primary models.

Guidance

  • Verify that the fallback candidates are being correctly configured and prioritized in the agent settings.
  • Investigate the LiveSessionModelSwitchError and candidate_failed reason=unknown errors to determine why the fallback candidates are being rejected before the API call.
  • Consider implementing a retry mechanism with exponential backoff for the primary model to prevent overwhelming the API with repeated requests.
  • Review the session lifecycle and model switching logic to ensure it is correctly handling rate-limited primary models and engaging the fallback chain.

Example

No code snippet is provided as the issue does not contain sufficient information to create a specific example.

Notes

The issue seems to be specific to the HTTP API endpoint and does not affect the Telegram integration, suggesting that the problem may be related to the session lifecycle or model switching logic in the HTTP endpoint.

Recommendation

Apply a workaround by switching the primary model to a paid model to prevent rate limiting, as described in the issue's workaround section, until a more permanent fix can be implemented.

FAIL-SAFE

If the issue persists, try to isolate the problem by testing the fallback chain with a different primary model or by reducing the number of fallback candidates to see if the issue is related to a specific model or configuration.

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