mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 15:13:43 +00:00
fix(agents): classify insufficient_quota 400s as billing (#36783)
This commit is contained in:
@@ -283,6 +283,11 @@ export function classifyFailoverReasonFromHttpStatus(
|
||||
return "rate_limit";
|
||||
}
|
||||
if (status === 400) {
|
||||
// Some providers return quota/balance errors under HTTP 400, so do not
|
||||
// let the generic format fallback mask an explicit billing signal.
|
||||
if (message && isBillingErrorMessage(message)) {
|
||||
return "billing";
|
||||
}
|
||||
return "format";
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -44,6 +44,7 @@ const ERROR_PATTERNS = {
|
||||
/["']?(?:status|code)["']?\s*[:=]\s*402\b|\bhttp\s*402\b|\berror(?:\s+code)?\s*[:=]?\s*402\b|\b(?:got|returned|received)\s+(?:a\s+)?402\b|^\s*402\s+payment/i,
|
||||
"payment required",
|
||||
"insufficient credits",
|
||||
/insufficient[_ ]quota/i,
|
||||
"credit balance",
|
||||
"plans & billing",
|
||||
"insufficient balance",
|
||||
|
||||
Reference in New Issue
Block a user