{"record":{"id":"63f691e436c69c8a","repo":"jackwener/OpenCLI","slug":"limit-must-be-25-github-trending-lists-at-mo","errorCode":null,"errorMessage":"--limit must be <= 25 (GitHub Trending lists at most 25 repositories)","messagePattern":"--limit must be <= 25 \\(GitHub Trending lists at most 25 repositories\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/github-trending/repos.js","lineNumber":125,"sourceCode":"    args: [\n        { name: 'since', type: 'string', default: 'daily', help: 'Time range: daily / weekly / monthly' },\n        { name: 'language', type: 'string', default: '', help: 'Filter by programming language slug, e.g. python, rust, \"c++\"' },\n        { name: 'limit', type: 'int', default: 25, help: 'Number of repositories to return (max 25)' },\n    ],\n    columns: ['rank', 'repo', 'description', 'language', 'stars', 'forks', 'starsSince', 'url'],\n    func: async (args) => {\n        const sinceKey = String(args.since ?? 'daily').toLowerCase();\n        const since = SINCE[sinceKey];\n        if (!since) {\n            throw new ArgumentError(`Unknown --since \"${sinceKey}\". Valid: ${Object.keys(SINCE).join(', ')}`);\n        }\n\n        const n = Number(args.limit ?? 25);\n        if (!Number.isInteger(n) || n <= 0) {\n            throw new ArgumentError('--limit must be a positive integer');\n        }\n        if (n > 25) {\n            throw new ArgumentError('--limit must be <= 25 (GitHub Trending lists at most 25 repositories)');\n        }\n        const limit = n;\n\n        const language = String(args.language ?? '').trim();\n        const path = language ? `/trending/${encodeURIComponent(language)}` : '/trending';\n        const url = new URL(`https://github.com${path}`);\n        url.searchParams.set('since', since);\n\n        let resp;\n        try {\n            resp = await fetch(url, {\n                headers: {\n                    'User-Agent': 'Mozilla/5.0 (compatible; opencli/github-trending)',\n                    Accept: 'text/html',\n                },\n            });\n        } catch (error) {\n            throw new CommandExecutionError(`github-trending request failed: ${error?.message || error}`);","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/github-trending/repos.js#L107-L143","documentation":"GitHub's Trending page lists at most 25 repositories per view, so the CLI rejects `--limit` values above 25 with this ArgumentError rather than silently truncating or making multiple requests. It is a documented upper-bound on the option.","triggerScenarios":"Calling the command with `--limit 50`, `--limit 100`, or any integer > 25.","commonSituations":"Assuming the CLI paginates like the GitHub search API; copying a --limit convention (e.g. 100) from other tools; wanting 'all' trending repos and guessing a large number.","solutions":["Use --limit 25 (or omit the flag) — that is the maximum GitHub Trending exposes per page","If more results are needed, combine language filters across separate invocations instead of raising the limit","Adjust scripts to clamp the limit: Math.min(Number(x), 25)"],"exampleFix":"// before\nopencli github-trending repos --limit 100\n// after\nopencli github-trending repos --limit 25","handlingStrategy":"validation","validationCode":"function clampLimit(v) { return Math.min(Number(v ?? 25), 25); }\nif (!Number.isInteger(limit) || limit <= 0 || limit > 25) throw new Error('--limit must be an integer 1-25');","typeGuard":"function isArgumentError(e) { return e instanceof Error && e.name === 'ArgumentError'; }","tryCatchPattern":"try {\n  await run(['opencli', 'github-trending', 'repos', '--limit', String(limit)]);\n} catch (e) {\n  if (/limit must be <= 25/.test(e.message)) { console.error('Max is 25; clamping.'); limit = 25; }\n  else throw e;\n}","preventionTips":["Clamp requested limits to 25 in scripts (GitHub Trending has at most 25 per page)","Don't copy --limit defaults from paginated APIs like GitHub Search","Omit --limit to accept the default 25"],"tags":["argument-validation","cli","input-error"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}