{"record":{"id":"48c46408b0cf894e","repo":"jackwener/OpenCLI","slug":"coingecko-categories-returned-http-resp-status","errorCode":null,"errorMessage":"coingecko categories returned HTTP ${resp.status}","messagePattern":"coingecko categories returned HTTP (.+?)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/categories.js","lineNumber":53,"sourceCode":"        if (limit > 100) {\n            throw new ArgumentError('coingecko limit must be <= 100');\n        }\n        const url = `https://api.coingecko.com/api/v3/coins/categories?order=${encodeURIComponent(sort)}`;\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 categories 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 categories returned HTTP ${resp.status}`);\n        }\n        let data;\n        try {\n            data = await resp.json();\n        }\n        catch (err) {\n            throw new CommandExecutionError(`coingecko categories returned malformed JSON: ${err?.message ?? err}`);\n        }\n        if (!Array.isArray(data) || !data.length) {\n            throw new EmptyResultError('coingecko categories', 'CoinGecko returned no category data.');\n        }\n        return data.slice(0, limit).map((cat, i) => ({\n            rank: i + 1,\n            id: String(cat.id ?? ''),\n            name: String(cat.name ?? ''),\n            marketCap: cat.market_cap != null ? Number(cat.market_cap) : null,\n            volume24h: cat.volume_24h != null ? Number(cat.volume_24h) : null,\n            marketCapChange24hPct: cat.market_cap_change_24h != null ? Number(cat.market_cap_change_24h) : null,","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/categories.js#L35-L71","documentation":"CoinGecko returned any non-ok HTTP status other than 429 (e.g. 500, 502, 503) and the CLI surfaces it as a CommandExecutionError with the status code. This is a server-side or API-level rejection of the request.","triggerScenarios":"api.coingecko.com returning 5xx during outages or maintenance; other 4xx/5xx statuses (e.g. 403 from WAF) that are not 429.","commonSituations":"CoinGecko service incidents; temporary API instability; requests blocked/filtered by CoinGecko's edge (403); using a deprecated endpoint path.","solutions":["Retry after a short wait; check the CoinGecko status page for incidents","If 403: reduce request rate and use a normal User-Agent (the CLI already sends one)","Check whether the endpoint URL/version changed and update the CLI"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight status check before dependent runs\nconst r = await fetch('https://api.coingecko.com/api/v3/coins/categories?order=market_cap_desc&limit=1');\nif (!r.ok && r.status !== 429) throw new Error(`CoinGecko unhealthy: HTTP ${r.status}`);","typeGuard":"function isServerError(err) {\n  return err instanceof CommandExecutionError && /HTTP \\d{3}/.test(err.message) && !/429/.test(err.message);\n}","tryCatchPattern":"try {\n  await runCategories(args);\n} catch (err) {\n  if (isServerError(err)) {\n    await sleep(10_000);\n    return runCategories(args); // or degrade gracefully\n  }\n  throw err;\n}","preventionTips":["Check the CoinGecko status page before large batch jobs","Implement exponential backoff for 5xx responses","Avoid deprecated endpoint paths; keep the CLI updated"],"tags":["http-error","network","server-error","coingecko"],"backgroundTag":"http-5xx-server-error","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}