fix(classifier): treat Anthropic "out of extra usage" 400 as billing - #56128
Merged
Conversation
Collaborator
Cherry-picks @charleneleong-ai's #11736 (earliest of the correct-direction cluster), strengthened with the rotate assertion from #13170 (@jack4git) -> related to the cluster (#11736 source, #13170, #40073), not a duplicate. Canonical consolidation PR that closes the correct-direction dupes on merge. |
teknium1
force-pushed
the
hermes/hermes-30e9481d
branch
4 times, most recently
from
July 1, 2026 08:18
03620e2 to
5992958
Compare
teknium1
enabled auto-merge (rebase)
July 1, 2026 08:18
teknium1
force-pushed
the
hermes/hermes-30e9481d
branch
from
July 1, 2026 08:30
5992958 to
81b69c2
Compare
Anthropic returns HTTP 400 with "You're out of extra usage. Add more at claude.ai/settings/usage and keep going." when the account's extra-usage allowance is depleted. The existing _BILLING_PATTERNS list did not include this wording, so classify_api_error fell through to generic format_error — non-retryable and should_fallback=False — causing the agent to abort instead of engaging the configured fallback chain. Add the pattern and a regression test covering the exact Anthropic body.
…tion When an Anthropic Claude Pro/Max OAuth subscription hits the "out of extra usage" 400 (now classified as billing), surface actionable guidance pointing at claude.ai/settings/usage and the cycle-reset option instead of the generic "add credits with that provider" line — which does not apply to a subscription. Folds in the UX from #40073 (@harsh-matchmyflight) without the extra FailoverReason enum; the billing reclass already provides the recovery behavior.
teknium1
force-pushed
the
hermes/hermes-30e9481d
branch
from
July 1, 2026 08:31
81b69c2 to
ab17839
Compare
This was referenced Jul 1, 2026
Closed
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Anthropic's
"out of extra usage"400 (OAuth Pro/Max overage bucket depleted) now classifies asbillinginstead of a genericformat_error— so the credential pool rotates and the payment/fallback chain engages.Root cause: the phrase wasn't in
_BILLING_PATTERNS, so a bare 400 carrying it fell through toformat_error(non-retryable, no credential rotation). The run just died on a hard 400 with the pool never advancing to a funded credential.Changes
agent/error_classifier.py: add"out of extra usage"to_BILLING_PATTERNS.tests/agent/test_error_classifier.py: assert billing / non-retryable / fallback / rotate.scripts/release.py: AUTHOR_MAP entry for @charleneleong-ai.Validation
400 "out of extra usage"format_errorbillingoauth_long_context_beta_forbidden; the 429 tier-gate still routes tolong_context_tier. Unaffected.Attribution
Cherry-picked @charleneleong-ai's commit (#11736, the earliest of the correct-direction cluster). Test strengthened with the
should_rotate_credentialassertion from #13170 (@jack4git). Rebase-merge preserves authorship.Closes the correct-direction dupes on merge: #11736 (source), #13170, #52869, #40073.
Note on the mistaken variant: #20850 proposed classifying this same phrase as a 1M-context-beta rejection and stripping the beta — that premise is wrong (the phrase is the overage gate, confirmed by P1 reports #28849/#28902/#32243). Closed separately.
Infographic
Nous Research
Update: folded in #40073's user-facing UX. When this 400 is terminal,
_billing_or_entitlement_message()now gives Anthropic-specific guidance (claude.ai/settings/usage + cycle-reset) instead of the generic "add credits" line. Done in the one place that owns billing guidance — no newFailoverReasonenum needed, since thebillingreclass already provides the recovery behavior. Credit @harsh-matchmyflight (#40073) for the UX direction. +2 tests.