{"record":{"id":"ecb62acc5f10b49b","repo":"jackwener/OpenCLI","slug":"coingecko-derivatives-limit-must-be-500","errorCode":null,"errorMessage":"coingecko derivatives limit must be <= 500","messagePattern":"coingecko derivatives limit must be <= 500","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/coingecko/derivatives.js","lineNumber":33,"sourceCode":"    site: 'coingecko',\n    name: 'derivatives',\n    access: 'read',\n    description: 'Top crypto derivative (perpetual / futures) markets by 24h volume',\n    domain: 'api.coingecko.com',\n    strategy: Strategy.PUBLIC,\n    browser: false,\n    args: [\n        { 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        }","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/coingecko/derivatives.js#L15-L51","documentation":"This ArgumentError is thrown when the `limit` argument is a valid positive integer but exceeds the hard cap of 500 imposed before querying CoinGecko's /derivatives endpoint. The cap keeps response sizes and API load bounded.","triggerScenarios":"Calling the derivatives command with --limit greater than 500, e.g. --limit 1000, after passing the positive-integer check.","commonSituations":"Users trying to fetch 'all' derivatives by passing a very large number, scripts bulk-exporting data without pagination awareness.","solutions":["Lower --limit to 500 or less, e.g. --limit 500","Paginate/filter instead (use the symbol substring filter to narrow results)","Split large exports into multiple calls of <= 500"],"exampleFix":"// before\ncli derivatives --limit 5000\n// after\ncli derivatives --limit 500","handlingStrategy":"validation","validationCode":"const n = Number(args.limit ?? 20);\nif (Number.isInteger(n) && n > 500) {\n  throw new Error('limit must be <= 500; use the symbol filter or paginate instead');\n}","typeGuard":"const isWithinCap = (v, cap = 500) => Number.isInteger(v) && v > 0 && v <= cap;","tryCatchPattern":null,"preventionTips":["Cap limits at 500 in your own scripts","Use the symbol substring filter to narrow results instead of raising the limit","Paginate large exports into batches of <= 500"],"tags":["validation","argument-error","limit","cli"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}