{"record":{"id":"dbec91bef806a583","repo":"alibaba/page-agent","slug":"server-error","errorCode":"SERVER_ERROR","errorMessage":"Server error: ${errorMessage}","messagePattern":"Server error: (.+?)","errorType":"http","errorClass":"InvokeError","httpStatus":500,"severity":"error","filePath":"packages/llms/src/OpenAIClient.ts","lineNumber":116,"sourceCode":"\t\t\t}\n\t\t\tconst errorMessage = errorData?.error?.message || response.statusText\n\n\t\t\tif (response.status === 401 || response.status === 403) {\n\t\t\t\tthrow new InvokeError(\n\t\t\t\t\tInvokeErrorTypes.AUTH_ERROR,\n\t\t\t\t\t`Authentication failed: ${errorMessage}`,\n\t\t\t\t\terrorData\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (response.status === 429) {\n\t\t\t\tthrow new InvokeError(\n\t\t\t\t\tInvokeErrorTypes.RATE_LIMIT,\n\t\t\t\t\t`Rate limit exceeded: ${errorMessage}`,\n\t\t\t\t\terrorData\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (response.status >= 500) {\n\t\t\t\tthrow new InvokeError(\n\t\t\t\t\tInvokeErrorTypes.SERVER_ERROR,\n\t\t\t\t\t`Server error: ${errorMessage}`,\n\t\t\t\t\terrorData\n\t\t\t\t)\n\t\t\t}\n\t\t\tthrow new InvokeError(\n\t\t\t\tInvokeErrorTypes.UNKNOWN,\n\t\t\t\t`HTTP ${response.status}: ${errorMessage}`,\n\t\t\t\terrorData\n\t\t\t)\n\t\t}\n\n\t\t// 4. Parse and validate response\n\t\tlet data: any\n\t\ttry {\n\t\t\tdata = await response.json()\n\t\t} catch (error) {\n\t\t\tif ((error as any)?.name === 'AbortError') throw error","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/alibaba/page-agent/blob/d02db1ee7c41f5315beda88bab2fe935c580f662/packages/llms/src/OpenAIClient.ts#L98-L134","documentation":"The endpoint returned an HTTP 5xx status — a server-side failure at the provider (overload, upstream crash, gateway timeout). The response body's error message (or statusText) is included, and the parsed errorData is attached as details.","triggerScenarios":"invoke() receives 500/502/503/504 from the provider: OpenAI incident, overloaded local inference server, OOM'd llama.cpp process, reverse proxy (nginx) returning 502 because the backend crashed.","commonSituations":"Provider outage (check status page); local model server running out of memory or crashing mid-request; gateway/proxy misrouting; very large prompts causing the upstream to time out and return 504.","solutions":["Retry with exponential backoff — 5xx is usually transient","If using a local/self-hosted server, check its logs and memory (reduce context length or model size)","Check the provider status page for ongoing incidents","Inspect attached errorData for the provider's specific error message"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"const isServerError = (e: unknown): e is InvokeError =>\n  e instanceof InvokeError && e.code === 'SERVER_ERROR'","tryCatchPattern":"try {\n  return await withRetry(() => client.invoke(req), { retries: 3, on: isServerError })\n} catch (e) {\n  if (isServerError(e)) notifyOps(`Provider 5xx: ${e.message}`)\n  throw e\n}","preventionTips":["Wrap invoke in exponential-backoff retry for 5xx only","Monitor provider status pages for incidents","For self-hosted servers, watch memory and set timeouts"],"tags":["server-error","http-5xx","openai-client"],"backgroundTag":"server-error-5xx","analyzedSha":"d02db1ee7c41f5315beda88bab2fe935c580f662","analyzedAt":"2026-08-28T19:39:48.634Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}