jackwener/OpenCLI · error · ArgumentError
lobsters limit must be <= ${maxValue}
Error message
lobsters limit must be <= ${maxValue} What it means
Thrown by requireBoundedInt() when the parsed limit is a positive integer but exceeds maxValue, the API's configured upper bound. The library enforces this locally so clients never send a request that Lobste.rs would reject or that would be wasteful.
Source
Thrown at clis/lobsters/domain.js:30
function requireDomain(value) {
const s = String(value ?? '').trim().toLowerCase();
if (!s) {
throw new ArgumentError('lobsters domain is required (e.g. "github.com" or "arxiv.org")');
}
if (!DOMAIN_PATTERN.test(s)) {
throw new ArgumentError(`lobsters domain "${value}" is not a valid hostname`);
}
return s;
}
function requireBoundedInt(value, defaultValue, maxValue) {
const raw = value ?? defaultValue;
const n = typeof raw === 'number' ? raw : Number(raw);
if (!Number.isInteger(n) || n <= 0) {
throw new ArgumentError('lobsters limit must be a positive integer');
}
if (n > maxValue) {
throw new ArgumentError(`lobsters limit must be <= ${maxValue}`);
}
return n;
}
cli({
site: 'lobsters',
name: 'domain',
access: 'read',
description: 'Lobste.rs stories submitted from a specific domain',
domain: 'lobste.rs',
strategy: Strategy.PUBLIC,
browser: false,
args: [
{ name: 'domain', positional: true, required: true, help: 'Source domain (e.g. github.com, arxiv.org, blog.cloudflare.com)' },
{ name: 'limit', type: 'int', default: 20, help: 'Number of stories (1-25 — single page)' },
],
columns: ['rank', 'id', 'title', 'score', 'author', 'comments', 'created_at', 'tags', 'submission_url', 'comments_url'],
func: async (args) => {View on GitHub (pinned to 49907e53dc)
Solutions
- Lower the limit to the allowed max (the error message states the exact bound, e.g. `<= 100`)
- Clamp before calling: Math.min(requested, maxValue)
- Update hardcoded configs/scripts that still use old, larger limits
- Consult the CLI docs for the current maximum allowed limit
Example fix
// before await cli.limit(1000); // max is 100 // after await cli.limit(Math.min(1000, 100));
Defensive patterns
Strategy: validation
Validate before calling
const MAX_LIMIT = 100; // check library docs for the exact bound const n = Number.parseInt(rawLimit, 10); await cli.limit(Number.isInteger(n) && n > 0 ? Math.min(n, MAX_LIMIT) : undefined);
Type guard
function isInBoundedRange(v, maxValue) {
return typeof v === 'number' && Number.isInteger(v) && v > 0 && v <= maxValue;
} Try / catch
try {
await cli.limit(n);
} catch (err) {
if (err instanceof ArgumentError && /limit must be <=/.test(err.message)) {
const max = Number(err.message.match(/<= (\d+)/)?.[1] ?? 100);
return cli.limit(Math.min(n, max));
}
throw err;
} Prevention
- Clamp user-supplied limits with Math.min(n, maxValue) at the boundary
- Centralize the max constant in one place shared by your config validation
- Re-check configs after upgrading the library in case the bound changed
When it happens
Trigger: Calling limit(n, defaultValue, maxValue) with n > maxValue, e.g. limit(500, 25, 100).
Common situations: Users pass `--limit 1000` expecting more results than the adapter allows; a config file holds an oversized value; the maxValue was tightened in a newer library version and previously valid configs now exceed it.
Related errors
- archive search sort must be one of ${SORT_OPTIONS.join(', ')
- archive search mediatype must be one of ${MEDIATYPES.join(',
- archive search limit must be a positive integer
- archive search limit must be <= 100
- archive search query must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/160f69b2413c67a5.
Report an issue: GitHub.