-
-
Notifications
You must be signed in to change notification settings - Fork 69.4k
[Bug]: Gateway session caches billing error state — renewing credits does not recover without gateway restart #40226
Description
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
- Configure OpenClaw with Anthropic as the model provider
- Let API credits run out mid-session (e.g. during active use)
- OpenClaw returns billing error:
⚠️ API provider returned a billing error - Top up Anthropic credits at console.anthropic.com
- Send a new message — still returns billing error
- Repeat credit top-up — same result
- Run
openclaw gateway restart - 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 restartto 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:
- Clear the cached error state after a configurable backoff so the next request attempts a fresh API call
- Start a background polling loop that checks if the error is still present every 30–60s and auto-recovers when credits are available
- 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.