#Fallback doesn't seem to be triggered

1 messages Β· Page 1 of 1 (latest)

balmy fable
#

I have this config in ~/.clawdbot/clawdbot.json:

"agents": {
    "defaults": {
      "model": {
        "primary": "anthropic/claude-opus-4-5",
        "fallbacks": [
          "openai-codex/gpt-5.2-codex"
        ]
      },
      "models": {
        "anthropic/claude-opus-4-5": {},
        "openai-codex/gpt-5.2-codex": {}
      }
   }
}

yet I still get {"type":"error","error":{"details":null,"type":"overloaded_error","message":"Overloaded"},"request_id":"req_011CX42VB511v1VS5XtmjZqz"} messages. This is likely due to Anthropic, byt when I manually force gpt-5.2-codex by itself, everything works fine. Which seems to indicate that the fallback doesn't intervene when Anthropic fails.

vocal quailBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> βœ… Mark Solution

graceful acornBOT
# balmy fable I have this config in `~/.clawdbot/clawdbot.json`: ```json "agents": { "def...

Good news β€” this is a known bug and there's already a PR open to fix it! πŸŽ‰

The Issue: PR #832 β€” "fix: handle Anthropic overloaded_error gracefully"

https://github.com/clawdbot/clawdbot/pull/832

The problem is that overloaded_error isn't recognized as a failover-worthy error (like rate limits are), so the fallback logic doesn't kick in. The PR fixes this by:

  1. Adding overloaded pattern detection
  2. Classifying it as rate_limit for failover purposes
  3. Showing a friendly message instead of raw JSON

Current Status: PR is open (opened today!) and awaiting merge.

Workarounds for now:

  1. Wait for the merge β€” should be merged soon given it's a hotfix
  2. Apply the fix manually β€” the PR shows exactly what changes are needed
#
  1. Use rate limit errors instead β€” if Anthropic returns rate_limit_error (different from overloaded_error), fallbacks will work

Your config is correct β€” the fallback mechanism itself is fine. It's just that overloaded_error specifically wasn't being handled as a retriable failure. The PR should fix this!

#

Investigation Complete: Model Fallback Issue

Root Cause: "Overloaded" errors are not configured to trigger fallbacks. This is expected behavior, not a bug.

What's happening:

  1. When Anthropic returns an "overloaded" error (HTTP 503 or message containing "overloaded"), it doesn't match any error pattern
  2. The coerceToFailoverError() check fails
  3. The error is thrown immediately without trying the fallback

Error patterns currently supported:

  • HTTP codes: 402 (billing), 429 (rate_limit), 401/403 (auth), 408 (timeout)
  • Messages: rate limit, timeout, billing, auth, format patterns

"Overloaded" is missing from:

  • ERROR_PATTERNS.rateLimit in pi-embedded-helpers.ts
  • HTTP 503 handling in failover-error.ts
#

To fix: Add "overloaded" or /overloaded/i to ERROR_PATTERNS.rateLimit in src/agents/pi-embedded-helpers.ts line ~409

#

Done! I've announced the investigation results to the Discord channel. The key finding: "overloaded" errors don't trigger fallbacks because they're not in the error pattern list. The fix is to add "overloaded" to ERROR_PATTERNS.rateLimit in pi-embedded-helpers.ts.

Stats: runtime 1m13s β€’ tokens 23.3k (in 12.3k / out 109) β€’ est $0.0000 β€’ sessionKey agent:main:subagent:8e53bb66-6edf-40e3-9a80-cbc202eb6e0d β€’ sessionId ae039b21-3f5c-4ce6-b7e3-6f99edc65c5f β€’ transcript /srv/clawdbot/state/agents/main/sessions/ae039b21-3f5c-4ce6-b7e3-6f99edc65c5f.jsonl

balmy fable
#

cool

graceful acornBOT
#

<final>
Fallback-Related Issues Search Complete πŸ”

Found several relevant issues and PRs in the Clawdbot repo:

Currently Open:

  • PR #832 - handle Anthropic overloaded_error gracefully (NEW - created today)
  • Issue #431 - GLM fallback returns 400 'Incorrect role information'
  • Issue #405 - Add automatic retry logic for transient API errors

Recently Closed (Fixed):

  • #313 - Model fallback not triggered on timeout (AbortError escape fix)
  • #486 - Billing/credit errors don't trigger failover
  • #761 - Credential failures should trigger model fallback

Key Merged PRs:

  • #604 - Fix model fallback error message handling
#
  • #223 - Retry fallback on rate limits
  • #799 - Default fallback chain (Opus β†’ Sonnet β†’ Haiku)
  • #822 - Credential validation β†’ auth error classification

Summary: The "overloaded" error issue you're seeing is being actively addressed in PR #832. Other major fallback bugs (timeouts, billing errors) were recently fixed.
</final>

Stats: runtime 48s β€’ tokens 17.5k (in 12 / out 399) β€’ est $0.0000 β€’ sessionKey agent:main:subagent:0b357a54-1ebc-4d88-b971-c603e7e49c41 β€’ sessionId 15ca1e69-77f2-4aca-8654-a116503b87aa β€’ transcript /srv/clawdbot/state/agents/main/sessions/15ca1e69-77f2-4aca-8654-a116503b87aa.jsonl

graceful acornBOT
# balmy fable cool

Glad that helps! 🦐 Feel free to mark the solution if you'd like β€” once PR #832 merges, the overload fallback should work automatically.