{"record":{"id":"717411fad6e5ad93","repo":"jackwener/OpenCLI","slug":"label-returned-http-resp-status-717411","errorCode":null,"errorMessage":"${label} returned HTTP ${resp.status}","messagePattern":"(.+?) returned HTTP (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/pypi/utils.js","lineNumber":45,"sourceCode":"        resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });\n    }\n    catch (err) {\n        throw new CommandExecutionError(\n            `${label} request failed: ${err?.message ?? err}`,\n            'Check that pypi.org / pypistats.org are reachable from this network.',\n        );\n    }\n    if (resp.status === 404) {\n        throw new EmptyResultError(label, `PyPI returned 404 for ${url}.`);\n    }\n    if (resp.status === 429) {\n        throw new CommandExecutionError(\n            `${label} returned HTTP 429 (rate limited)`,\n            'PyPI throttles unauthenticated bursts; wait a few seconds and retry.',\n        );\n    }\n    if (!resp.ok) {\n        throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);\n    }\n    let body;\n    try {\n        body = await resp.json();\n    }\n    catch (err) {\n        throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);\n    }\n    return body;\n}\n","sourceCodeStart":27,"sourceCodeEnd":56,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pypi/utils.js#L27-L56","documentation":"CommandExecutionError thrown by pypiFetch when the response status is not ok and is not one of the specially-handled codes (404, 429) — e.g. 500, 502, 503. The message carries the label and the raw status code. It indicates a server-side problem rather than bad input.","triggerScenarios":"Any pypiFetch call receiving 5xx or other unexpected statuses: PyPI outages, CDN/ Fastly errors (502/503), gateway misconfigurations, or rare 3xx handled as non-ok by fetch redirects settings.","commonSituations":"Running the command during a PyPI incident (check pypistatus); transient CDN errors; aggressive caching proxies returning 5xx.","solutions":["Retry after a short delay — most 5xx are transient","Check PyPI status page for ongoing incidents","Bypass local proxies/CDN caches if suspected","Report persistent errors to your network team if a proxy is interfering"],"exampleFix":"// shell before/after\n# before\npypi package requests   # 502 during CDN incident\n# after\nsleep 5 && pypi package requests","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  const pkg = await pypiPackage(name);\n} catch (e) {\n  if (/HTTP 5\\d\\d/.test(e.message)) {\n    // transient server-side failure: retry with backoff\n  } else throw e;\n}","preventionTips":["Check PyPI status page during outages before assuming client bugs","Retry 5xx responses with backoff; they are usually transient","Avoid pinning to unstable mirrors or middleboxed endpoints"],"tags":["pypi","http","server-error"],"backgroundTag":"http-5xx-server-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}