jackwener/OpenCLI · error · CommandExecutionError
${label} returned HTTP ${resp.status}
Error message
${label} returned HTTP ${resp.status} What it means
Catch-all for any non-OK HTTP status from Wikidata that is not specifically handled as 404 or 429 (e.g. 500, 502, 503, 403). wikidataFetch throws a CommandExecutionError carrying the raw status code, since anonymous users rarely need differentiated handling beyond 'the request failed server-side'.
Source
Thrown at clis/wikidata/utils.js:82
resp = await fetch(url, { headers: { 'user-agent': UA, accept: 'application/json' } });
}
catch (err) {
throw new CommandExecutionError(
`${label} request failed: ${err?.message ?? err}`,
'Check that www.wikidata.org is reachable from this network.',
);
}
if (resp.status === 404) {
throw new EmptyResultError(label, `Wikidata returned 404 for ${url}.`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
`${label} returned HTTP 429 (rate limited)`,
'Wikidata throttles anonymous traffic; back off 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;
}
/**
* Pick a localised label / description from a `{<lang>: {value}}` map.
* Falls back to English if the requested language is missing.
*/
export function pickLocalised(map, language) {
if (!map || typeof map !== 'object') return null;
const direct = map[language];View on GitHub (pinned to 49907e53dc)
Solutions
- Retry after a short delay — 5xx is usually transient
- Check the Wikidata/Wikimedia status page for an ongoing incident
- Log the full URL and status; verify the request is not being intercepted by a proxy or firewall
- If status is 403, review your User-Agent and request volume against Wikimedia's User-Agent policy
Example fix
// before
const body = await wikidataFetch(url, 'search');
// after
try {
const body = await wikidataFetch(url, 'search');
} catch (err) {
if (/HTTP 5\d\d/.test(String(err.message))) {
await new Promise(r => setTimeout(r, 2000));
return retry(); // transient server error
}
throw err;
} Defensive patterns
Strategy: retry
Try / catch
try {
const body = await wikidataFetch(url, label);
} catch (err) {
if (/HTTP [5]/.test(String(err.message))) {
await new Promise(r => setTimeout(r, 2000));
return wikidataFetch(url, label); // retry transient 5xx
}
throw err;
} Prevention
- Retry 5xx responses with backoff — they are usually transient
- Monitor the Wikimedia status page during incidents
- Send a compliant, descriptive User-Agent
- Check for corporate proxy interference when errors persist
When it happens
Trigger: Wikidata returning 5xx during an outage or maintenance; a 403 from aggressive/abusive-traffic filtering on the shared UA; HTTP-level redirects or proxy interference producing unexpected statuses.
Common situations: Wikidata service incidents (check wikitech status); corporate proxies or firewalls rewriting responses; making requests during known maintenance windows.
Related errors
- coingecko categories returned HTTP ${resp.status}
- ${label} returned HTTP ${resp.status}
- Flomo API returned HTTP ${resp.status}
- arXiv API HTTP ${resp.status}
- Bilibili creator comparison request failed: ${detail}
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/4b039e83159f81dc.
Report an issue: GitHub.