๐คฏ LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
๐ง chore(model-runtime): add 42 user/upstream error patterns (#19812)
Arvin Xud7ef57ac740a
diff --git a/packages/model-runtime/src/errors/match.test.ts b/packages/model-runtime/src/errors/match.test.tsindex fb9fe2f3f49..bae041e1211 100644--- a/packages/model-runtime/src/errors/match.test.ts+++ b/packages/model-runtime/src/errors/match.test.ts@@ -577,3 +577,213 @@ describe('2026-09 triage harvest (production residue)', () => {expect(matchErrorPattern({ message: 'Forbidden', provider: 'lobehub' })).toBeUndefined();});});++describe('2026-09 production residue โ second harvest', () => {+ // Every message below is a verbatim upstream error observed in production.+ // None of the patterns they exercise match first-party provider errors.+ const cases: [string, string][] = [+ // ExceededContextWindow+ [+ 'Input token count (272370) exceeds system limit (262144) (request id: 021789663165372e56)',+ AgentRuntimeErrorType.ExceededContextWindow,+ ],+ [+ 'channel input token limit exceeded: estimated input tokens 141238 > limit 131072 (request id: 2026092210)',+ AgentRuntimeErrorType.ExceededContextWindow,+ ],+ // InsufficientQuota+ [+ 'need pre-deduct ๏ผ0.061, balance ๏ผ0.000 is insufficient (request id: 2026092211)',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'The request failed because your account has an overdue balance. Request id: 021789663165',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ "User's credit limit is insufficient, remaining credit limit: ๏ผ0.00 (request id: 2026092212)",+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'hแบฟt credit (vรญ Pay-as-you-go), sแป dฦฐ: 0 (request id: 2026092213)',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ "You've reached your usage limit for this billing cycle. Your quota will be refreshed in the next cycle.",+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'This prompt is longer than the free tier allows for a single request. Shorten it, or add credits to use this model.',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'user [12] quota [3400] preConsumedQuota [51000] is not enough',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ '403 "You have run out of credits or need a Grok subscription. Add credits at https://x.ai or upgrade."',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ "Not enough credit to cover this request's estimated maximum cost. Shorten the request, or top up.",+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'You have reached your specified workspace API usage limits. You will regain access on 2026-10-01 at 00:00 UTC.',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ '403 "Your newly created team doesn\'t have any credits or licenses yet. You can purchase those on the billing page."',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ ['403 "insufficient_gpt_quota"', AgentRuntimeErrorType.InsufficientQuota],+ [+ '่ฎข้ ้ขๅบฆไธ่ถณๆๆช้ ็ฝฎ่ฎข้ : subscription quota insufficient, need=1 (request id: 2026092214)',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ [+ 'You have insufficient credits to make this request. Please purchase more credits to continue using the service.',+ AgentRuntimeErrorType.InsufficientQuota,+ ],+ ['{"error":"ไฝ้ขไธ่ถณ"}', AgentRuntimeErrorType.InsufficientQuota],+ ['403 No active subscription found for this group', AgentRuntimeErrorType.InsufficientQuota],+ // RateLimitExceeded+ [+ 'LLM stream error: ResourceExhausted: Worker local total request limit reached (8/8)',+ AgentRuntimeErrorType.RateLimitExceeded,+ ],+ [+ "429 Rate limit exceeded. Refer to 'x-ratelimit-*' headers for details, and 'retry-after' header for when to retry.",+ AgentRuntimeErrorType.RateLimitExceeded,+ ],+ [+ 'ๆจๅทฒ่พพๅฐๆป่ฏทๆฑๆฐ้ๅถ๏ผ5ๅ้ๅ ๆๅค่ฏทๆฑ5ๆฌก๏ผๅ ๆฌๅคฑ่ดฅๆฌกๆฐ๏ผ่ฏทๆฃๆฅๆจ็่ฏทๆฑๆฏๅฆๆญฃ็กฎ (request id: 2026092215)',+ AgentRuntimeErrorType.RateLimitExceeded,+ ],+ // ProviderServiceUnavailable+ [+ 'This model is temporarily at capacity. Please try again shortly or use a different model.',+ AgentRuntimeErrorType.ProviderServiceUnavailable,+ ],+ // NoAvailableChannel+ ['{"detail":"ๆๆ ๅฏ็จๅญ่ฏ"}', AgentRuntimeErrorType.NoAvailableChannel],+ [+ 'No available Gemini accounts: no available accounts',+ AgentRuntimeErrorType.NoAvailableChannel,+ ],+ // ModelNotFound+ [+ 'Publisher model `projects/open-command-1/locations/global/publishers/google/models/gemini-3.1-pro-preview` was not found or your project does not have access to it.',+ AgentRuntimeErrorType.ModelNotFound,+ ],+ [+ 'Invalid model. Please select a different model to continue.',+ AgentRuntimeErrorType.ModelNotFound,+ ],+ [+ "Unknown model 'zyloo/claude-sonnet-5'. See zyloo.io/models for the supported list.",+ AgentRuntimeErrorType.ModelNotFound,+ ],+ [+ 'The model gemini-2.5-flash-free has been retired and is no longer available. (tid: 2026092216)',+ AgentRuntimeErrorType.ModelNotFound,+ ],+ [+ '{"error":{"message":"Requested model DeepSeek-V4-Flash not supported","type":"invalid_request_error","param":null,"code":null}}',+ AgentRuntimeErrorType.ModelNotFound,+ ],+ // InvalidProviderAPIKey+ [+ 'Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential.',+ AgentRuntimeErrorType.InvalidProviderAPIKey,+ ],+ ['API key ๅทฒ่ฟๆ', AgentRuntimeErrorType.InvalidProviderAPIKey],+ // PermissionDenied+ [+ "Permission denied: Consumer 'api_key:AIzaSyXXXX' has been suspended.",+ AgentRuntimeErrorType.PermissionDenied,+ ],+ [+ 'Access to model denied. Please make sure you are eligible for using the model.',+ AgentRuntimeErrorType.PermissionDenied,+ ],+ [+ 'The latest version of this model is only available hosted in China and requires explicit opt in: https://example.com/docs',+ AgentRuntimeErrorType.PermissionDenied,+ ],+ // CapabilityNotSupported+ [+ 'registry.ollama.ai/library/gemma3:4b does not support tools',+ AgentRuntimeErrorType.CapabilityNotSupported,+ ],+ [+ 'The requested model does not support the coding plan feature. Please refer to the documentation to select a compatible model.',+ AgentRuntimeErrorType.CapabilityNotSupported,+ ],+ [+ 'Reasoning is mandatory for this endpoint and cannot be disabled.',+ AgentRuntimeErrorType.CapabilityNotSupported,+ ],+ // ContentModeration+ [+ 'Your prompt or reference material was rejected by content moderation. Please revise it and submit again. (request id: 2026092217)',+ AgentRuntimeErrorType.ContentModeration,+ ],+ // UserConfigError+ [+ 'anthropic-workspace-id is required when authenticating with an identity-linked API key; send the id of the workspace.',+ AgentRuntimeErrorType.UserConfigError,+ ],+ [+ 'This host has been retired. Point your base URL at https://api.example.com โ your API key is unchanged.',+ AgentRuntimeErrorType.UserConfigError,+ ],+ ['404 Replit AI Integrations is not configured', AgentRuntimeErrorType.UserConfigError],+ [+ 'The product is not activated, please confirm that you have activated products and try again after activation.',+ AgentRuntimeErrorType.UserConfigError,+ ],+ ];++ it.each(cases)('classifies %j', (message, expected) => {+ expect(+ matchErrorPattern({ errorType: AgentRuntimeErrorType.ProviderBizError, message })?.code,+ ).toBe(expected);+ expect(isUserSideError(AgentRuntimeErrorType.ProviderBizError, message)).toBe(true);+ });++ it('keeps `Requested model` as the model-not-found discriminator', () => {+ // The relay wraps both rejections in the same JSON envelope, so a bare+ // `not supported","type":"invalid_request_error"` substring would also+ // claim parameter rejections and hand the user model-not-found guidance.+ expect(+ matchErrorPattern({+ message:+ '{"error":{"message":"Parameter temperature is not supported","type":"invalid_request_error","param":null,"code":null}}',+ })?.code,+ ).not.toBe(AgentRuntimeErrorType.ModelNotFound);+ });++ it('leaves plain account-suspension messages on AccountDeactivated', () => {+ // The PermissionDenied section is matched before AccountDeactivated, so the+ // consumer-suspension entry must stay scoped to the Google wording.+ for (const message of [+ 'Your account has been suspended.',+ '403 Your account has been suspended. Please contact support.',+ ]) {+ expect(matchErrorPattern({ message })?.code).toBe(AgentRuntimeErrorType.AccountDeactivated);+ }+ });++ it('leaves the two first-party-colliding candidates unclassified', () => {+ // Both phrases also reach us from the first-party provider, so they were+ // held back from this round rather than narrowed: keeping our own failures+ // visible outranks classifying a few more upstream rows.+ for (const message of [+ 'System protection triggered by request burst. Please slow down traffic growth.',+ 'The current model cannot be routed at the moment, please try again later. (tid: 2026092218)',+ ]) {+ expect(matchErrorPattern({ message, provider: 'lobehub' })).toBeUndefined();+ }+ });+});diff --git a/packages/model-runtime/src/errors/patterns.ts b/packages/model-runtime/src/errors/patterns.tsindex 1d60398dd05..ef2fbbebdd6 100644--- a/packages/model-runtime/src/errors/patterns.ts+++ b/packages/model-runtime/src/errors/patterns.ts@@ -143,6 +143,18 @@ export const ERROR_PATTERNS: ErrorPattern[] = [},{ code: AgentRuntimeErrorType.ExceededContextWindow, match: sub('input tokens and requested') },+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.ExceededContextWindow,+ match: sub('exceeds system limit'),+ note: 'volcengine: input token count over the account-level system limit',+ },+ {+ code: AgentRuntimeErrorType.ExceededContextWindow,+ match: sub('channel input token limit exceeded'),+ note: 'new-api style relay channel input cap',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// InsufficientQuota โ account balance / billing exhausted (long-term)// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -413,6 +425,83 @@ export const ERROR_PATTERNS: ErrorPattern[] = [match: sub('no credits remaining'),},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('need pre-deduct'),+ note: 'new-api pre-deduction against an empty balance',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('has an overdue balance'),+ note: 'volcengine / openai-compat overdue account',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('credit limit is insufficient'),+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('hแบฟt credit'),+ note: 'Vietnamese relay: pay-as-you-go wallet empty',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('reached your usage limit for this billing cycle'),+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('longer than the free tier allows'),+ note: 'anthropic free tier single-request cap',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('preConsumedQuota'),+ note: 'one-api / new-api pre-consumed quota check',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('run out of credits or need a'),+ note: 'xAI / Grok subscription required',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('Not enough credit to cover this request'),+ note: 'OpenRouter max-cost estimate',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('reached your specified workspace API usage limits'),+ note: 'anthropic workspace spend cap',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('any credits or licenses yet'),+ note: 'team seat / credit not purchased yet',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('insufficient_gpt_quota'),+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('่ฎข้ ้ขๅบฆไธ่ถณๆๆช้ ็ฝฎ่ฎข้ '),+ note: 'relay: subscription quota exhausted or unset',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('insufficient credits to make this request'),+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('ไฝ้ขไธ่ถณ'),+ note: 'relay balance exhausted (Chinese)',+ },+ {+ code: AgentRuntimeErrorType.InsufficientQuota,+ match: sub('No active subscription found for this group'),+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// RateLimitExceeded โ short-window rate limit (transient, retryable)// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -485,6 +574,23 @@ export const ERROR_PATTERNS: ErrorPattern[] = [match: sub('per-user model TPM limit'),},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.RateLimitExceeded,+ match: sub('Worker local total request limit reached'),+ note: 'nvidia NIM worker concurrency cap',+ },+ {+ code: AgentRuntimeErrorType.RateLimitExceeded,+ match: sub('Rate limit exceeded. Refer to'),+ note: 'upstream points at x-ratelimit-* / retry-after headers',+ },+ {+ code: AgentRuntimeErrorType.RateLimitExceeded,+ match: sub('ๆจๅทฒ่พพๅฐๆป่ฏทๆฑๆฐ้ๅถ'),+ note: 'relay: per-window total request cap (Chinese)',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// ProviderServiceUnavailable โ 503 / overload (transient)// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -578,6 +684,12 @@ export const ERROR_PATTERNS: ErrorPattern[] = [note: 'Aggregator proxies wrap a transient upstream outage in a bare 500.',},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.ProviderServiceUnavailable,+ match: sub('is temporarily at capacity'),+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// RemoteMediaDownloadTimeout โ provider-side remote media fetch// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -702,6 +814,17 @@ export const ERROR_PATTERNS: ErrorPattern[] = [match: sub('"code":"NOT_FOUND","msg":"route not found"'),},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.NoAvailableChannel,+ match: sub('ๆๆ ๅฏ็จๅญ่ฏ'),+ note: 'relay has no usable credential left',+ },+ {+ code: AgentRuntimeErrorType.NoAvailableChannel,+ match: sub('No available Gemini accounts'),+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// ModelNotFound// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -767,6 +890,31 @@ export const ERROR_PATTERNS: ErrorPattern[] = [note: 'Gemini retires a model for accounts that never called it before.',},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.ModelNotFound,+ match: sub('was not found or your project does not have access'),+ note: 'Vertex publisher model not enabled for the project',+ },+ {+ code: AgentRuntimeErrorType.ModelNotFound,+ match: sub('Invalid model. Please select a different model'),+ },+ {+ code: AgentRuntimeErrorType.ModelNotFound,+ match: sub("Unknown model '"),+ note: 'relay rejects an unknown model id',+ },+ {+ code: AgentRuntimeErrorType.ModelNotFound,+ match: sub('has been retired and is no longer available'),+ },+ {+ code: AgentRuntimeErrorType.ModelNotFound,+ match: { kind: 'regex', value: /Requested model .+ not supported/ },+ note: 'openai-compat relay: requested model not served. Keeps the `Requested model` discriminator so generic `... is not supported` parameter rejections in the same JSON envelope stay out.',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// InvalidVertexCredentials// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -827,6 +975,18 @@ export const ERROR_PATTERNS: ErrorPattern[] = [match: sub('bound service account is deleted or disabled'),},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.InvalidProviderAPIKey,+ match: sub('Request had invalid authentication credentials'),+ note: 'Google: expected OAuth2 token / valid key',+ },+ {+ code: AgentRuntimeErrorType.InvalidProviderAPIKey,+ match: sub('API key ๅทฒ่ฟๆ'),+ note: 'relay: key expired (Chinese)',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// InvalidGithubToken / InvalidGithubCopilotToken// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -877,6 +1037,23 @@ export const ERROR_PATTERNS: ErrorPattern[] = [},{ code: AgentRuntimeErrorType.PermissionDenied, match: sub('does not allow the current client') },+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.PermissionDenied,+ match: sub('Permission denied: Consumer '),+ note: 'Google: api_key consumer suspended. Scoped to the consumer wording so `account has been suspended` still reaches AccountDeactivated below.',+ },+ {+ code: AgentRuntimeErrorType.PermissionDenied,+ match: sub('Access to model denied'),+ note: 'qwen / bailian: account not eligible for the model',+ },+ {+ code: AgentRuntimeErrorType.PermissionDenied,+ match: sub('requires explicit opt in'),+ note: 'region-hosted model needs an explicit account opt-in',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// AccountDeactivated// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -952,6 +1129,22 @@ export const ERROR_PATTERNS: ErrorPattern[] = [note: 'Chinese aggregators reject unsupported image / PDF / tools / thinking capabilities.',},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.CapabilityNotSupported,+ match: sub('does not support tools'),+ },+ {+ code: AgentRuntimeErrorType.CapabilityNotSupported,+ match: sub('does not support the coding plan feature'),+ note: 'volcengine coding-plan model mismatch',+ },+ {+ code: AgentRuntimeErrorType.CapabilityNotSupported,+ match: sub('Reasoning is mandatory for this endpoint'),+ note: 'OpenRouter reasoning-only endpoint',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// ContentModeration// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -1010,6 +1203,12 @@ export const ERROR_PATTERNS: ErrorPattern[] = [note: 'Alibaba/Qwen content-safety rejection, delivered as a JSON error code.',},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.ContentModeration,+ match: sub('rejected by content moderation'),+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// RequestBodyTooLarge โ serialized request exceeded an upstream body limit// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ@@ -1237,6 +1436,26 @@ export const ERROR_PATTERNS: ErrorPattern[] = [match: sub('OpenAIException - {"detail":"Not Found"}'),},+ // Harvested from the 2026-09 production residue.+ {+ code: AgentRuntimeErrorType.UserConfigError,+ match: sub('anthropic-workspace-id is required'),+ },+ {+ code: AgentRuntimeErrorType.UserConfigError,+ match: sub('This host has been retired'),+ note: 'upstream moved; user must repoint baseURL',+ },+ {+ code: AgentRuntimeErrorType.UserConfigError,+ match: sub('Replit AI Integrations is not configured'),+ },+ {+ code: AgentRuntimeErrorType.UserConfigError,+ match: sub('The product is not activated'),+ note: 'qwen: product not activated on the account',+ },+// โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ// UpstreamGatewayError โ proxy / gateway-layer failure (openresty, litellm,// HTML error bodies, Cloudflare 525). Distinct from the provider's own