openclaw - ✅(Solved) Fix [Bug]: Generic "API rate limit" error hides provider-specific quota message [2 pull requests, 2 comments, 3 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#54433Fetched 2026-04-08 01:27:36
View on GitHub
Comments
2
Participants
3
Timeline
24
Reactions
0
Timeline (top)
referenced ×15cross-referenced ×3commented ×2labeled ×2

When the openai-codex provider returns a plan usage limit error, OpenClaw surfaces a generic "API rate limit reached" message instead of the provider's specific error with the reset time.

Error Message

When the openai-codex provider returns a plan usage limit error, OpenClaw provider's specific error with the reset time. 4. Observe the error shown to the user The provider's specific error message is shown, e.g.: [agent/embedded] embedded run agent end: ... error=⚠️ API rate limit reached. Please try again later. rawError=You have hit your ChatGPT usage limit (go plan). Try again in ~4381 min.

Root Cause

When the openai-codex provider returns a plan usage limit error, OpenClaw surfaces a generic "API rate limit reached" message instead of the provider's specific error with the reset time.

PR fix notes

PR #54512: fix: surface provider-specific rate limit error message (#54433)

Description (problem / solution / changelog)

Summary

  • Fixes #54433
  • When a provider returns a rate limit error with a specific message (e.g. quota details, reset time), surface that message to the user instead of the generic "API rate limit reached"
  • The provider's rawError was already captured internally but never shown to the user

Test plan

  • Configure a provider that returns rate limit errors with specific messages
  • Verify the specific message is shown to the user instead of the generic one

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/pi-embedded-helpers.formatassistanterrortext.test.ts (modified, +52/-0)
  • src/agents/pi-embedded-helpers/errors.ts (modified, +44/-1)

PR #54594: fix(errors): surface provider-specific rate-limit message instead of generic fallback

Description (problem / solution / changelog)

Summary

Fixes #54433.

When a provider returns a specific rate-limit error (e.g. "You have hit your ChatGPT usage limit (go plan). Try again in ~4381 min."), OpenClaw was discarding it and showing a generic fallback message instead.

Root Cause

formatRateLimitOrOverloadedErrorCopy() in src/agents/pi-embedded-helpers/errors.ts always returned the generic "⚠️ API rate limit reached. Please try again later." message, ignoring the provider-specific rawError.

Fix

Added an extractProviderRateLimitMessage() helper that:

  1. Tries to extract the inner message from JSON error payloads (e.g. {"error":{"message":"..."}})
  2. Strips common error prefixes (Error:, OpenAI API error:, HTTP status codes) to give a clean message
  3. Returns undefined for non-human-readable payloads (e.g. HTML error pages) so the generic fallback is used

formatRateLimitOrOverloadedErrorCopy() now uses the provider message when available, falling back to the generic message only when no useful text can be extracted.

Testing

  • 3 new test cases for provider-specific message extraction
  • Updated 2 existing test expectations to match corrected output

Changed files

  • src/agents/pi-embedded-helpers.formatassistanterrortext.test.ts (modified, +26/-0)
  • src/agents/pi-embedded-helpers.sanitizeuserfacingtext.test.ts (modified, +2/-2)
  • src/agents/pi-embedded-helpers/errors.ts (modified, +39/-1)
  • src/agents/pi-embedded-subscribe.subscribe-embedded-pi-session.subscribeembeddedpisession.test.ts (modified, +1/-1)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Summary

When the openai-codex provider returns a plan usage limit error, OpenClaw surfaces a generic "API rate limit reached" message instead of the provider's specific error with the reset time.

Steps to reproduce

  1. Configure OpenClaw with openai-codex/gpt-5.4 via OAuth (Go plan)
  2. Exhaust the Go plan's monthly message quota
  3. Send any message through Telegram or Dashboard
  4. Observe the error shown to the user

Expected behavior

The provider's specific error message is shown, e.g.: "You have hit your ChatGPT usage limit (go plan). Try again in ~4381 min."

Actual behavior

User sees only: "⚠️ API rate limit reached. Please try again later." The rawError field is logged internally but never surfaced to the user. Gateway log line: [agent/embedded] embedded run agent end: ... error=⚠️ API rate limit reached. Please try again later. rawError=You have hit your ChatGPT usage limit (go plan). Try again in ~4381 min.

OpenClaw version

2026.3.24 (60cd98a)

Operating system

macOS (Apple Silicon M3)

Install method

pnpm dev (source)

Model

openai-codex/gpt-5.4

Provider / routing chain

openclaw -> openai-codex (OAuth)

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

Affected: Any user on a capped plan (ChatGPT Go, Plus, etc.) Severity: High — causes hours of misdirected troubleshooting Frequency: Always, whenever plan quota is exhausted Consequence: User cannot distinguish a transient rate limit from a plan usage cap with a 3-day reset, leading them to debug Gemini keys, web search config, and other unrelated settings instead of simply waiting. The fix is straightforward: rawError is already captured — just pass it through to the user-facing message.

Additional information

No response

extent analysis

Fix Plan

To fix the issue, we need to modify the error handling mechanism to surface the provider's specific error message instead of the generic "API rate limit reached" message. Here are the steps:

  • Modify the error handling function to check for the presence of rawError and use it to construct the user-facing error message.
  • Update the logging mechanism to include the rawError field in the log output.

Example code:

def handle_error(error):
    if 'rawError' in error:
        # Use the rawError field to construct the user-facing error message
        error_message = error['rawError']
    else:
        # Fallback to the generic error message
        error_message = "API rate limit reached. Please try again later."
    return error_message

# Update the logging mechanism to include the rawError field
def log_error(error):
    log_message = f"Error: {error['message']}"
    if 'rawError' in error:
        log_message += f" (rawError: {error['rawError']})"
    print(log_message)

Verification

To verify that the fix worked, follow these steps:

  • Reproduce the issue by exhausting the Go plan's monthly message quota and sending a message through Telegram or Dashboard.
  • Check that the error message displayed to the user is the provider's specific error message, including the reset time.
  • Verify that the log output includes the rawError field.

Extra Tips

  • Make sure to test the fix with different error scenarios to ensure that the error handling mechanism is working correctly.
  • Consider adding additional logging or monitoring to track errors and improve the overall reliability of the system.

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…

FAQ

Expected behavior

The provider's specific error message is shown, e.g.: "You have hit your ChatGPT usage limit (go plan). Try again in ~4381 min."

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING