{"record":{"id":"df4a829a3d2fe0e5","repo":"jackwener/OpenCLI","slug":"coingecko-derivatives-request-failed-err-messa","errorCode":null,"errorMessage":"coingecko derivatives request failed: ${err?.message ?? err}","messagePattern":"coingecko derivatives request failed: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/derivatives.js","lineNumber":41,"sourceCode":"        { name: 'limit', type: 'int', default: 20, help: 'Max rows to return (1-500; CoinGecko returns one large page).' },\n        { name: 'symbol', type: 'string', required: false, help: 'Optional symbol substring filter (e.g. \"BTC\", \"ETHUSDT\").' },\n    ],\n    columns: ['rank', 'market', 'symbol', 'indexId', 'contractType', 'price', 'change24hPct', 'fundingRate', 'openInterestUsd', 'volume24hUsd', 'expired'],\n    func: async (args) => {\n        const limit = Number(args.limit ?? 20);\n        if (!Number.isInteger(limit) || limit <= 0) {\n            throw new ArgumentError('coingecko derivatives limit must be a positive integer');\n        }\n        if (limit > 500) {\n            throw new ArgumentError('coingecko derivatives limit must be <= 500');\n        }\n        const filter = args.symbol == null ? '' : String(args.symbol).trim().toUpperCase();\n        let resp;\n        try {\n            resp = await fetch(ENDPOINT, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko derivatives request failed: ${err?.message ?? err}`);\n        }\n        if (resp.status === 429) {\n            throw new CommandExecutionError(\n                'coingecko derivatives 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 derivatives returned HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko derivatives returned malformed JSON: ${err?.message ?? err}`);\n        }\n        if (!Array.isArray(data) || !data.length) {","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/derivatives.js#L23-L59","documentation":"This CommandExecutionError wraps any failure of the fetch() call to the CoinGecko /derivatives ENDPOINT, embedding the underlying error message. It indicates the HTTP request never completed — DNS failure, connection refused/reset, TLS error, timeout, or offline network.","triggerScenarios":"Network outage or no DNS resolution, CoinGecko unreachable/firewalled, TLS interception, IPv6 issues, request aborted by proxy — any case where fetch rejects.","commonSituations":"Corporate proxies blocking api.coingecko.com, CI runners without internet access, DNS misconfiguration, transient CoinGecko connectivity incidents.","solutions":["Check network connectivity and that https://api.coingecko.com is reachable (curl -I)","Retry after a short wait — often transient","Inspect the wrapped message for the root cause (ENOTFOUND, ECONNREFUSED, etc.) and fix DNS/proxy accordingly","Configure proxy/HTTPS_PROXY env vars if behind a corporate firewall"],"exampleFix":"// before\nresp = await fetch(ENDPOINT); // fails behind proxy\n// after\n// set HTTPS_PROXY / HTTP_PROXY env vars, then retry\nresp = await fetch(ENDPOINT, { headers: { 'User-Agent': 'Mozilla/5.0' } });","handlingStrategy":"retry","validationCode":"// Reachability pre-check (optional)\nconst ping = await fetch('https://api.coingecko.com/api/v3/ping').catch(() => null);\nif (!ping) throw new Error('api.coingecko.com unreachable — check network/proxy/DNS');","typeGuard":"const isNetworkError = (err) => err instanceof TypeError || /ENOTFOUND|ECONNREFUSED|ECONNRESET|ETIMEDOUT|fetch failed/i.test(String(err?.cause?.code ?? err?.message ?? err));","tryCatchPattern":"try {\n  resp = await fetch(ENDPOINT, { headers: { 'User-Agent': 'Mozilla/5.0' } });\n} catch (err) {\n  // transient network failure: retry with backoff\n  for (let i = 0; i < 3; i++) {\n    await new Promise(r => setTimeout(r, 2 ** i * 1000));\n    try { resp = await fetch(ENDPOINT); break; } catch (_) {}\n  }\n  if (!resp) throw new Error(`coingecko derivatives request failed: ${err?.message ?? err}`);\n}","preventionTips":["Add exponential backoff retries around fetch calls","Verify HTTPS_PROXY/DNS settings in corporate and CI environments","Fail fast with a reachability ping before batch jobs"],"tags":["network","fetch","http-request","connectivity"],"backgroundTag":"request-failed","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}