jackwener/OpenCLI · error · CommandExecutionError
coingecko global request failed: ${err?.message ?? err}
Error message
coingecko global request failed: ${err?.message ?? err} What it means
This CommandExecutionError wraps any network-level failure of the fetch() call to https://api.coingecko.com/api/v3/global — DNS failure, connection refused, TLS error, or abort. The underlying error message (e.g. ENOTFOUND, ECONNREFUSED) is embedded in the thrown message for diagnosis.
Source
Thrown at clis/coingecko/global.js:28
description: 'Aggregate crypto market stats: total market cap, volume, dominance',
domain: 'api.coingecko.com',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'currency', type: 'string', default: 'usd', help: 'Quote currency for total market cap / volume (usd, cny, eur, jpy, ...)' },
],
columns: ['currency', 'totalMarketCap', 'totalVolume24h', 'marketCapChange24hPct', 'btcDominancePct', 'ethDominancePct', 'activeCryptocurrencies', 'markets', 'ongoingIcos', 'updatedAt'],
func: async (args) => {
const currency = String(args.currency ?? 'usd').trim().toLowerCase();
if (!/^[a-z0-9-]{2,20}$/.test(currency)) {
throw new ArgumentError(`coingecko currency must look like a currency slug (got "${args.currency}")`);
}
let resp;
try {
resp = await fetch('https://api.coingecko.com/api/v3/global', { headers: { 'User-Agent': 'Mozilla/5.0' } });
}
catch (err) {
throw new CommandExecutionError(`coingecko global 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 global returned HTTP ${resp.status}`);
}
let body;
try {
body = await resp.json();
}
catch (err) {
throw new CommandExecutionError(`coingecko global returned malformed JSON: ${err?.message ?? err}`);
}
const data = body?.data;View on GitHub (pinned to 49907e53dc)
Solutions
- Verify reachability: `curl -I https://api.coingecko.com/api/v3/ping`.
- Fix DNS/proxy settings (HTTPS_PROXY, corporate allowlist for api.coingecko.com) and retry.
- Use the embedded cause message (ENOTFOUND vs ECONNREFUSED vs CERT errors) to target the specific network issue.
- Add retry with backoff for transient connectivity blips in automation.
- Run from an environment with internet egress if fully firewalled.
Defensive patterns
Strategy: retry
Try / catch
try {
await globalCmd.func({ currency: 'usd' });
} catch (e) {
if (/coingecko global request failed/.test(e.message)) {
await sleep(2000);
return withRetry(() => globalCmd.func({ currency: 'usd' }), 3);
}
throw e;
} Prevention
- Confirm egress with `curl https://api.coingecko.com/api/v3/ping` in deployment scripts.
- Set HTTPS_PROXY/NO_PROXY correctly in containers and CI.
- Wrap network commands in retry-with-backoff helpers.
- Monitor DNS health in Docker/K8s (ENOTFOUND is the usual culprit).
When it happens
Trigger: fetch() throws before receiving a response: no internet access, DNS cannot resolve api.coingecko.com, firewall/proxy blocking the host, TLS interception failure, or the request being aborted.
Common situations: Air-gapped or offline environments, CI runners without egress, corporate proxies, VPN disconnections, or Docker/K8s DNS misconfiguration.
Related errors
- coingecko exchanges request failed: ${err?.message ?? err}
- Failed to fetch Flomo memos: ${err instanceof Error ? err.me
- stack exchange request failed: ${error?.message || error}
- archive wayback request failed: ${error?.message || error}
- Failed to fetch Chess.com API ${url}: ${error?.message || er
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/e16f0205e5c544b3.
Report an issue: GitHub.