Skip to content

[Bug]: Gateway session caches billing error state — renewing credits does not recover without gateway restart #40226

@CipherMindBob

Description

@CipherMindBob

Summary

After an Anthropic billing error, renewing credits does not restore functionality. The gateway session retains the cached error state and continues returning billing errors on every subsequent message, even after the account is topped up. Only openclaw gateway restart clears the state and resumes normal operation.

Steps to Reproduce

  1. Configure OpenClaw with Anthropic as the model provider
  2. Let API credits run out mid-session (e.g. during active use)
  3. OpenClaw returns billing error: ⚠️ API provider returned a billing error
  4. Top up Anthropic credits at console.anthropic.com
  5. Send a new message — still returns billing error
  6. Repeat credit top-up — same result
  7. Run openclaw gateway restart
  8. Send a new message — now works

Expected Behavior

After credits are renewed, the gateway should:

  • Detect the account is no longer in an error state on the next request (or via polling)
  • Recover automatically without requiring a manual gateway restart
  • At minimum: surface a clear actionable message — "Credits renewed? Run openclaw gateway restart to resume"

Actual Behavior

Gateway silently retains the billing error state. Every message continues to fail with the same billing error regardless of account status. No user-facing guidance is provided. The session appears fully broken until a manual gateway restart is performed.

Why This Is Distinct From #24622

Issue #24622 describes a gateway that hangs on billing errors. This issue describes a gateway that recovers from the hang but caches the error state, making credit renewal ineffective without a restart.

Environment

  • OpenClaw: 2026.2.26 (bc50708)
  • Provider: Anthropic (claude-sonnet-4-6)
  • Channel: Telegram
  • OS: macOS Sequoia (Darwin 24.6.0, x64)
  • Trigger: Credits depleted mid-session during active use

Suggested Fix

In the billing error handler, either:

  1. Clear the cached error state after a configurable backoff so the next request attempts a fresh API call
  2. Start a background polling loop that checks if the error is still present every 30–60s and auto-recovers when credits are available
  3. Add a provider health check endpoint that the gateway can poll after a billing error

Workaround

openclaw gateway restart clears the stale state and immediately resumes normal operation after credits are renewed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions