jackwener/OpenCLI · error · ArgumentError
coingecko derivatives limit must be <= 500
Error message
coingecko derivatives limit must be <= 500
What it means
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.
Source
Thrown at clis/coingecko/derivatives.js:33
site: 'coingecko',
name: 'derivatives',
access: 'read',
description: 'Top crypto derivative (perpetual / futures) markets by 24h volume',
domain: 'api.coingecko.com',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'limit', type: 'int', default: 20, help: 'Max rows to return (1-500; CoinGecko returns one large page).' },
{ name: 'symbol', type: 'string', required: false, help: 'Optional symbol substring filter (e.g. "BTC", "ETHUSDT").' },
],
columns: ['rank', 'market', 'symbol', 'indexId', 'contractType', 'price', 'change24hPct', 'fundingRate', 'openInterestUsd', 'volume24hUsd', 'expired'],
func: async (args) => {
const limit = Number(args.limit ?? 20);
if (!Number.isInteger(limit) || limit <= 0) {
throw new ArgumentError('coingecko derivatives limit must be a positive integer');
}
if (limit > 500) {
throw new ArgumentError('coingecko derivatives limit must be <= 500');
}
const filter = args.symbol == null ? '' : String(args.symbol).trim().toUpperCase();
let resp;
try {
resp = await fetch(ENDPOINT, { headers: { 'User-Agent': 'Mozilla/5.0' } });
}
catch (err) {
throw new CommandExecutionError(`coingecko derivatives request failed: ${err?.message ?? err}`);
}
if (resp.status === 429) {
throw new CommandExecutionError(
'coingecko derivatives returned HTTP 429 (rate limited)',
'Free tier allows ~30 calls/min. Wait and retry.',
);
}
if (!resp.ok) {
throw new CommandExecutionError(`coingecko derivatives returned HTTP ${resp.status}`);
}View on GitHub (pinned to 49907e53dc)
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
Example fix
// before cli derivatives --limit 5000 // after cli derivatives --limit 500
Defensive patterns
Strategy: validation
Validate before calling
const n = Number(args.limit ?? 20);
if (Number.isInteger(n) && n > 500) {
throw new Error('limit must be <= 500; use the symbol filter or paginate instead');
} Type guard
const isWithinCap = (v, cap = 500) => Number.isInteger(v) && v > 0 && v <= cap;
Prevention
- 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
When it happens
Trigger: Calling the derivatives command with --limit greater than 500, e.g. --limit 1000, after passing the positive-integer check.
Common situations: Users trying to fetch 'all' derivatives by passing a very large number, scripts bulk-exporting data without pagination awareness.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- archive search limit must be <= 100
- 'limit', 'must be a positive integer ≤ 200'
- limit must be <= ${MAX_LIMIT}
- --limit must be between 1 and 100, got ${parsed}
- archive search sort must be one of ${SORT_OPTIONS.join(', ')
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/ecb62acc5f10b49b.
Report an issue: GitHub.