openclaw - 💡(How to fix) Fix Model fallback not triggered on 429 rate_limit_error — retries same provider indefinitely [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#59303Fetched 2026-04-08 02:26:13
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Error Message

All errors have the Anthropic error message: "This request would exceed your account's rate limit. Please try again later."

Code Example

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-6",
        "fallbacks": ["google/gemini-2.0-flash"]
      }
    }
  }
}

---

23:24:37429 rate_limit_error (anthropic/claude-opus-4-6)
23:24:45429 rate_limit_error (anthropic/claude-opus-4-6)
23:24:55429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:04429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:08429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:16429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:25429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:30429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:36429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:47429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:03429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:08429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:15429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:25429 rate_limit_error (anthropic/claude-opus-4-6)
23:59:52429 rate_limit_error (anthropic/claude-opus-4-6)
23:59:57429 rate_limit_error (anthropic/claude-opus-4-6)
00:00:03429 rate_limit_error (anthropic/claude-opus-4-6)
00:00:14429 rate_limit_error (anthropic/claude-opus-4-6)
... (continues, google/gemini-2.0-flash never attempted)
RAW_BUFFERClick to expand / collapse

Bug Description

When the primary model (anthropic/claude-opus-4-6) returns HTTP 429 rate_limit_error, OpenClaw retries the same provider indefinitely instead of falling back to the configured fallback model (google/gemini-2.0-flash).

Config

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-6",
        "fallbacks": ["google/gemini-2.0-flash"]
      }
    }
  }
}

Auth setup: Two Anthropic token profiles (anthropic:default + anthropic:manual) with auth order configured. Both are Claude Max accounts (not API keys).

Observed Behavior

  • Session receives a user message
  • OpenClaw attempts anthropic/claude-opus-4-6 → gets 429 rate_limit_error
  • Instead of falling back to google/gemini-2.0-flash, it retries the same provider 20+ times over ~30 minutes
  • All retries fail with identical 429 errors
  • The session becomes completely unresponsive — user never receives a reply
  • The fallback model is never attempted

Expected Behavior

After exhausting retries on the primary provider (including cycling through auth profiles), OpenClaw should fall back to the next model in the fallbacks array.

Evidence from Session Logs

23:24:37 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:24:45 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:24:55 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:04 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:08 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:29:16 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:25 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:30 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:36 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:42:47 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:03 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:08 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:15 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:43:25 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:59:52 → 429 rate_limit_error (anthropic/claude-opus-4-6)
23:59:57 → 429 rate_limit_error (anthropic/claude-opus-4-6)
00:00:03 → 429 rate_limit_error (anthropic/claude-opus-4-6)
00:00:14 → 429 rate_limit_error (anthropic/claude-opus-4-6)
... (continues, google/gemini-2.0-flash never attempted)

All errors have the Anthropic error message: "This request would exceed your account's rate limit. Please try again later."

Note: The Claude Max account had available usage (only 10% of weekly limit used) — the 429 was a burst rate limit, not a quota exhaustion.

Environment

  • OpenClaw version: 2026.3.24
  • OS: macOS (Darwin arm64)
  • Auth: Claude Max token auth (not API key)
  • Two auth profiles configured with auth order

Suggested Fix

  1. After N consecutive 429s from the same provider (e.g., 3-5 attempts), trigger model fallback
  2. Alternatively, respect Retry-After headers and if the wait exceeds a threshold, fall back immediately
  3. Consider cycling through auth profiles first, then falling back to the next model in the fallback chain

extent analysis

TL;DR

Implement a fallback mechanism to switch to the next model in the fallbacks array after a specified number of consecutive 429 errors from the primary provider.

Guidance

  • Review the OpenClaw configuration to ensure that the fallback model (google/gemini-2.0-flash) is correctly specified and that the auth setup is properly configured.
  • Consider implementing a retry limit (e.g., 3-5 attempts) before triggering the model fallback to prevent indefinite retries.
  • Respect the Retry-After headers in the 429 error response to determine the appropriate wait time before retrying or falling back to the next model.
  • Verify that the Claude Max account usage is within the allowed limits and that the 429 error is not due to quota exhaustion.

Example

No code snippet is provided as the issue does not require a specific code change, but rather a configuration or logic adjustment.

Notes

The suggested fix implies that the issue is related to the retry mechanism in OpenClaw, which is not properly handling consecutive 429 errors from the primary provider. The fallback mechanism should be triggered after a specified number of retries to prevent indefinite retries and allow the system to switch to the next available model.

Recommendation

Apply a workaround by implementing a retry limit and respecting the Retry-After headers to trigger the model fallback, as this will allow the system to recover from consecutive 429 errors and switch to the next available model.

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