{"record":{"id":"ab46a11a917a34db","repo":"jackwener/OpenCLI","slug":"coingecko-coin-request-failed-error-message","errorCode":null,"errorMessage":"coingecko coin request failed: ${error?.message || error}","messagePattern":"coingecko coin request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/coin.js","lineNumber":51,"sourceCode":"        }\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\n        const url = new URL(`https://api.coingecko.com/api/v3/coins/${id}`);\n        url.searchParams.set('localization', 'false');\n        url.searchParams.set('tickers', 'false');\n        url.searchParams.set('market_data', 'true');\n        url.searchParams.set('community_data', 'false');\n        url.searchParams.set('developer_data', 'false');\n        url.searchParams.set('sparkline', 'false');\n\n        let resp;\n        try {\n            resp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n        } catch (error) {\n            throw new CommandExecutionError(`coingecko coin request failed: ${error?.message || error}`);\n        }\n        if (resp.status === 404) {\n            throw new EmptyResultError('coingecko coin', `coingecko has no coin with id \"${id}\".`);\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError('coingecko returned HTTP 429 (rate limited)', 'Free tier allows ~30 calls/min. Wait and retry.');\n        }\n        if (!resp.ok) {\n            throw new CommandExecutionError(`coingecko coin failed: HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        } catch (error) {\n            throw new CommandExecutionError(`coingecko returned malformed JSON: ${error?.message || error}`);\n        }\n        if (data?.error) {\n            throw new CommandExecutionError(`coingecko returned error: ${data.error}`);","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/coin.js#L33-L69","documentation":"This CommandExecutionError wraps any network-level failure of the fetch() call to api.coingecko.com — DNS resolution errors, connection refused/reset, TLS errors, or timeouts. The command makes a plain HTTPS GET with a browser User-Agent; if the request never gets an HTTP response, the underlying error message is interpolated into this message.","triggerScenarios":"No internet connectivity; DNS failure resolving api.coingecko.com; firewall/proxy blocking the request; TLS interception; Node fetch socket timeout; IPv6 connectivity issues.","commonSituations":"Running the CLI in CI environments without network egress; corporate proxies that block or MITM api.coingecko.com; offline laptop; VPN dropping mid-call.","solutions":["Check network connectivity (e.g. `curl -I https://api.coingecko.com/api/v3/ping`)","Check proxy/VPN/firewall settings and set HTTPS_PROXY if a corporate proxy is required","Retry after transient network issues; consider adding timeout/retry logic around the CLI call"],"exampleFix":"// before\nresp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n// after\nresp = await fetch(url, { headers: { 'User-Agent': 'Mozilla/5.0' }, signal: AbortSignal.timeout(15000) }); // plus retry-once on failure","handlingStrategy":"retry","validationCode":"const reachable = await fetch('https://api.coingecko.com/api/v3/ping', { signal: AbortSignal.timeout(5000) }).then(r => r.ok).catch(() => false);\nif (!reachable) throw new Error('api.coingecko.com unreachable — check network/proxy');","typeGuard":"null","tryCatchPattern":"try { await run(['coingecko', 'coin', id]); } catch (e) { if (/request failed/.test(e.message)) { await sleep(2000); return retryOnce(); } throw e; }","preventionTips":["Check connectivity/proxy (HTTPS_PROXY, VPN) before batch runs","Add explicit timeouts and a bounded retry with backoff around CLI calls","Prefer running from environments with confirmed egress to api.coingecko.com"],"tags":["network","fetch","api-request"],"backgroundTag":"network-request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}