-
-
Notifications
You must be signed in to change notification settings - Fork 69.6k
Rate limit detection missing 'too many tokens per day' pattern (AWS Bedrock) #38822
Copy link
Copy link
Closed
Closed
Copy link
Description
Problem
AWS Bedrock models return a specific error message when daily token limits are exceeded:
Too many tokens per day
This error is not recognized by OpenClaw as a rate-limit condition, causing the primary model to keep failing without properly triggering fallback.
Root Cause
The rate limit detection regex in OpenClaw only matches:
/(rate[_ ]limit|too many requests|429|resource has been exhausted|cloudflare)/iMissing patterns:
too many tokens per day(AWS Bedrock specific)tokens per dayquota exceeded(some providers)
Impact
- Primary model keeps failing repeatedly
- Fallback chain doesn't trigger properly
- System appears "stuck" trying the same broken model
- No circuit breaker for repeated failures
Suggested Fix
Add missing patterns to the rate limit detection:
// gateway-cli-CuFEx2ht.js (line ~5780)
rate_limit: /(rate[_ ]limit|too many requests|429|resource has been exhausted|cloudflare|too many tokens|tokens per day)/i,
// api-key-rotation-5wHpygo9.js
if (lower.includes("too many tokens")) return true;
if (lower.includes("tokens per day")) return true;Workaround Applied (local)
We've patched the compiled files locally:
- Added
too many tokensandtokens per dayto the regex - Gateway restarted successfully
Environment
- OpenClaw version: 2026.3.2
- Platform: Ubuntu 22.04
- Node.js: v25.8.0
Thank you for considering this fix! 🦞
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Fields
Give feedbackNo fields configured for issues without a type.