{"record":{"id":"0b8dd795b296b450","repo":"jackwener/OpenCLI","slug":"coingecko-derivatives-returned-http-429-rate-limi","errorCode":null,"errorMessage":"coingecko derivatives returned HTTP 429 (rate limited)","messagePattern":"coingecko derivatives returned HTTP 429 \\(rate limited\\)","errorType":"http","errorClass":"CommandExecutionError","httpStatus":429,"severity":"warning","filePath":"clis/coingecko/derivatives.js","lineNumber":44,"sourceCode":"    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) {\n            throw new EmptyResultError('coingecko derivatives', 'CoinGecko returned no derivative tickers.');\n        }\n        let rows = data;","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/derivatives.js#L26-L62","documentation":"This CommandExecutionError is thrown when the CoinGecko /derivatives endpoint responds with HTTP 429, meaning the client has exceeded the free-tier rate limit (~30 calls/min). A remediation hint is included as the error's second argument.","triggerScenarios":"Making more than ~30 requests per minute to CoinGecko's free API; tight polling loops or many concurrent invocations of the derivatives command.","commonSituations":"Scripts polling in a loop without delay, CI jobs running many lookups in parallel, shared IP (VPN/CI runner) already rate-limited by other users.","solutions":["Wait at least 60 seconds and retry with backoff","Add throttling (e.g. 2s sleep between calls) or an exponential backoff/retry loop in scripts","Upgrade to a paid CoinGecko plan with an API key for higher limits","Cache responses to reduce duplicate calls"],"exampleFix":"// before\nwhile (true) { cli derivatives } // hammers API\n// after\n// throttle calls\nawait sleep(2000);\ncli derivatives --limit 20","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// detect 429 and back off\nif (resp.status === 429) {\n  const retryAfter = Number(resp.headers.get('retry-after') ?? 60);\n  await new Promise(r => setTimeout(r, retryAfter * 1000));\n  resp = await fetch(ENDPOINT); // retry once\n}","preventionTips":["Throttle calls to stay under ~30 req/min on the free tier","Honor the Retry-After header when present","Cache results to avoid repeat lookups","Use a paid API key for higher rate limits"],"tags":["rate-limit","http-429","api","retry"],"backgroundTag":"http-429-rate-limited","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}