jackwener/OpenCLI · error · CommandExecutionError
coingecko categories returned HTTP ${resp.status}
Error message
coingecko categories returned HTTP ${resp.status} What it means
CoinGecko returned any non-ok HTTP status other than 429 (e.g. 500, 502, 503) and the CLI surfaces it as a CommandExecutionError with the status code. This is a server-side or API-level rejection of the request.
Source
Thrown at clis/coingecko/categories.js:53
if (limit > 100) {
throw new ArgumentError('coingecko limit must be <= 100');
}
const url = `https://api.coingecko.com/api/v3/coins/categories?order=${encodeURIComponent(sort)}`;
let resp;
try {
resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });
}
catch (err) {
throw new CommandExecutionError(`coingecko categories request failed: ${err?.message ?? err}`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
'coingecko returned HTTP 429 (rate limited)',
'Free tier allows ~30 calls/min. Wait and retry.',
);
}
if (!resp.ok) {
throw new CommandExecutionError(`coingecko categories returned HTTP ${resp.status}`);
}
let data;
try {
data = await resp.json();
}
catch (err) {
throw new CommandExecutionError(`coingecko categories returned malformed JSON: ${err?.message ?? err}`);
}
if (!Array.isArray(data) || !data.length) {
throw new EmptyResultError('coingecko categories', 'CoinGecko returned no category data.');
}
return data.slice(0, limit).map((cat, i) => ({
rank: i + 1,
id: String(cat.id ?? ''),
name: String(cat.name ?? ''),
marketCap: cat.market_cap != null ? Number(cat.market_cap) : null,
volume24h: cat.volume_24h != null ? Number(cat.volume_24h) : null,
marketCapChange24hPct: cat.market_cap_change_24h != null ? Number(cat.market_cap_change_24h) : null,View on GitHub (pinned to 49907e53dc)
Solutions
- Retry after a short wait; check the CoinGecko status page for incidents
- If 403: reduce request rate and use a normal User-Agent (the CLI already sends one)
- Check whether the endpoint URL/version changed and update the CLI
Defensive patterns
Strategy: retry
Validate before calling
// preflight status check before dependent runs
const r = await fetch('https://api.coingecko.com/api/v3/coins/categories?order=market_cap_desc&limit=1');
if (!r.ok && r.status !== 429) throw new Error(`CoinGecko unhealthy: HTTP ${r.status}`); Type guard
function isServerError(err) {
return err instanceof CommandExecutionError && /HTTP \d{3}/.test(err.message) && !/429/.test(err.message);
} Try / catch
try {
await runCategories(args);
} catch (err) {
if (isServerError(err)) {
await sleep(10_000);
return runCategories(args); // or degrade gracefully
}
throw err;
} Prevention
- Check the CoinGecko status page before large batch jobs
- Implement exponential backoff for 5xx responses
- Avoid deprecated endpoint paths; keep the CLI updated
When it happens
Trigger: api.coingecko.com returning 5xx during outages or maintenance; other 4xx/5xx statuses (e.g. 403 from WAF) that are not 429.
Common situations: CoinGecko service incidents; temporary API instability; requests blocked/filtered by CoinGecko's edge (403); using a deprecated endpoint path.
Related errors
- ${label} returned HTTP ${resp.status}
- Flomo API returned HTTP ${resp.status}
- ${label} 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/48c46408b0cf894e.
Report an issue: GitHub.