jackwener/OpenCLI · error · CommandExecutionError
${label} returned HTTP ${resp.status}
Error message
${label} returned HTTP ${resp.status} What it means
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.
Source
Thrown at clis/pypi/utils.js:45
resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
}
catch (err) {
throw new CommandExecutionError(
`${label} request failed: ${err?.message ?? err}`,
'Check that pypi.org / pypistats.org are reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `PyPI returned 404 for ${url}.`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
`${label} returned HTTP 429 (rate limited)`,
'PyPI throttles unauthenticated bursts; wait a few seconds and retry.',
);
}
if (!resp.ok) {
throw new CommandExecutionError(`${label} returned HTTP ${resp.status}`);
}
let body;
try {
body = await resp.json();
}
catch (err) {
throw new CommandExecutionError(`${label} returned malformed JSON: ${err?.message ?? err}`);
}
return body;
}
View on GitHub (pinned to 49907e53dc)
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
Example fix
// shell before/after # before pypi package requests # 502 during CDN incident # after sleep 5 && pypi package requests
Defensive patterns
Strategy: retry
Validate before calling
null
Type guard
null
Try / catch
try {
const pkg = await pypiPackage(name);
} catch (e) {
if (/HTTP 5\d\d/.test(e.message)) {
// transient server-side failure: retry with backoff
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Running the command during a PyPI incident (check pypistatus); transient CDN errors; aggressive caching proxies returning 5xx.
Related errors
- Detached HEAD — checkout a branch first
- coingecko derivatives returned HTTP ${resp.status}
- Ctrip flight API returned HTTP ${status || 'unknown'}
- ${label} returned HTTP ${resp.status}
- HTTP ${result.httpStatus} from /api/auth/session
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/717411fad6e5ad93.
Report an issue: GitHub.