{"record":{"id":"e16f0205e5c544b3","repo":"jackwener/OpenCLI","slug":"coingecko-global-request-failed-err-message","errorCode":null,"errorMessage":"coingecko global request failed: ${err?.message ?? err}","messagePattern":"coingecko global request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/global.js","lineNumber":28,"sourceCode":"    description: 'Aggregate crypto market stats: total market cap, volume, dominance',\n    domain: 'api.coingecko.com',\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { name: 'currency', type: 'string', default: 'usd', help: 'Quote currency for total market cap / volume (usd, cny, eur, jpy, ...)' },\n    ],\n    columns: ['currency', 'totalMarketCap', 'totalVolume24h', 'marketCapChange24hPct', 'btcDominancePct', 'ethDominancePct', 'activeCryptocurrencies', 'markets', 'ongoingIcos', 'updatedAt'],\n    func: async (args) => {\n        const currency = String(args.currency ?? 'usd').trim().toLowerCase();\n        if (!/^[a-z0-9-]{2,20}$/.test(currency)) {\n            throw new ArgumentError(`coingecko currency must look like a currency slug (got \"${args.currency}\")`);\n        }\n        let resp;\n        try {\n            resp = await fetch('https://api.coingecko.com/api/v3/global', { headers: { 'User-Agent': 'Mozilla/5.0' } });\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko global request failed: ${err?.message ?? err}`);\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError(\n                'coingecko returned HTTP 429 (rate limited)',\n                'Free tier allows ~30 calls/min. Wait and retry.',\n            );\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`coingecko global returned HTTP ${resp.status}`);\n        }\n        let body;\n        try {\n            body = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko global returned malformed JSON: ${err?.message ?? err}`);\n        }\n        const data = body?.data;","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/global.js#L10-L46","documentation":"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.","triggerScenarios":"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.","commonSituations":"Air-gapped or offline environments, CI runners without egress, corporate proxies, VPN disconnections, or Docker/K8s DNS misconfiguration.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await globalCmd.func({ currency: 'usd' });\n} catch (e) {\n  if (/coingecko global request failed/.test(e.message)) {\n    await sleep(2000);\n    return withRetry(() => globalCmd.func({ currency: 'usd' }), 3);\n  }\n  throw e;\n}","preventionTips":["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)."],"tags":["network","fetch-failed","dns"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}