-
-
Notifications
You must be signed in to change notification settings - Fork 39.9k
Closed
Description
Bug Description
When Anthropic returns an HTTP 429 TPD (Tokens Per Day) rate limit error, OpenClaw incorrectly displays it as:
⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model.
This is misleading because the actual issue is rate limiting, not context overflow.
Root Cause
The regex in isLikelyContextOverflowError() is too broad:
/(?:prompt|request).*(too (?:large|long)|exceed|over|limit|max(?:imum)?)/iThe Anthropic 429 error message:
request reached organization TPD rate limit, current: 1506556, limit: 1500000
This matches request + limit in the regex, causing it to be classified as a context overflow error.
Expected Behavior
Rate limit errors (HTTP 429) should be displayed as rate limit / quota errors, not as context overflow.
Steps to Reproduce
- Exceed the Anthropic TPD token limit (1.5M tokens/day)
- Send a message via Discord channel
- All fallback models fail with 429
- OpenClaw shows "Context overflow" instead of a rate limit error
Environment
- OpenClaw version: 2026.2.9
- Model: anthropic/claude-opus-4-6
- Channel: Discord
Suggested Fix
Either:
- Add a negative lookahead/check to exclude rate limit errors before testing context overflow regex
- Check for rate limit errors first (higher priority) before falling through to context overflow classification
- Tighten the regex to require context-specific terms (e.g. require "context" or "token" near "limit")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels