{"record":{"id":"32b7fcdd12b6f904","repo":"jackwener/OpenCLI","slug":"coingecko-exchanges-request-failed-err-message","errorCode":null,"errorMessage":"coingecko exchanges request failed: ${err?.message ?? err}","messagePattern":"coingecko exchanges request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/exchanges.js","lineNumber":42,"sourceCode":"        if (!Number.isInteger(limit) || limit <= 0) {\n            throw new ArgumentError('coingecko limit must be a positive integer');\n        }\n        if (limit > 250) {\n            throw new ArgumentError('coingecko limit must be <= 250 (per_page upper bound)');\n        }\n        const page = Number(args.page ?? 1);\n        if (!Number.isInteger(page) || page <= 0) {\n            throw new ArgumentError('coingecko page must be a positive integer');\n        }\n        const url = new URL('https://api.coingecko.com/api/v3/exchanges');\n        url.searchParams.set('per_page', String(limit));\n        url.searchParams.set('page', String(page));\n        let resp;\n        try {\n            resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko exchanges 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 exchanges returned HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko exchanges returned malformed JSON: ${err?.message ?? err}`);\n        }\n        if (!Array.isArray(data) || !data.length) {","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/exchanges.js#L24-L60","documentation":"This CommandExecutionError wraps any network-level failure of the fetch() call to https://api.coingecko.com/api/v3/exchanges — DNS resolution failure, connection refused/reset, TLS errors, or request aborts. The original error's message is interpolated so the underlying cause (e.g. 'getaddrinfo ENOTFOUND') is preserved in the message.","triggerScenarios":"fetch() throws before an HTTP response exists: no network connectivity, DNS cannot resolve api.coingecko.com, an offline/air-gapped environment, a proxy blocking the request, TLS interception, or the process aborting the fetch.","commonSituations":"Running the CLI in CI containers without egress, corporate firewalls/proxies blocking api.coingecko.com, VPN drops mid-request, or DNS misconfiguration in Docker/Kubernetes environments.","solutions":["Check network connectivity: `curl -I https://api.coingecko.com/api/v3/ping` to see if the host is reachable at all.","Fix DNS or proxy configuration (set HTTPS_PROXY, corporate proxy, or /etc/hosts) and retry.","Inspect the embedded cause in the message (e.g. ENOTFOUND vs ECONNREFUSED) to target the right fix.","Add retry with backoff in your wrapper for transient network errors, since this command is a single-shot fetch.","If behind a strict firewall, allowlist api.coingecko.com or run from a machine with egress."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const rows = await exchanges.func({ page: 1 });\n} catch (e) {\n  if (/coingecko exchanges request failed/.test(e.message)) {\n    // network-level failure: retry with backoff\n    await sleep(2000);\n    return withRetry(() => exchanges.func({ page: 1 }), 3);\n  }\n  throw e;\n}","preventionTips":["Check connectivity (ping/curl api.coingecko.com) before batch runs.","Configure proxy env vars (HTTPS_PROXY) correctly in CI/containers.","Add retry-with-backoff wrappers around all network commands.","Allowlist api.coingecko.com in corporate firewalls."],"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"}