jackwener/OpenCLI · error · ArgumentError
indeed ${label} must be <= ${maxValue}
Error message
indeed ${label} must be <= ${maxValue} What it means
requireBoundedInt also enforces an upper bound: after confirming the value is a positive integer, it rejects values greater than maxValue with an ArgumentError naming the label and the cap. This prevents requests that the downstream Indeed API would reject or that the CLI deliberately caps for safety.
Source
Thrown at clis/indeed/utils.js:40
/**
* Coerce a value to a strict integer. Accepts numeric strings, rejects
* floats / non-numeric / NaN. Returns NaN on invalid input so callers can
* decide on the right typed error.
*/
export function coerceInt(value) {
if (value === undefined || value === null || value === '') return NaN;
const n = typeof value === 'number' ? value : Number(value);
return Number.isFinite(n) && Number.isInteger(n) ? n : NaN;
}
export function requireBoundedInt(value, defaultValue, maxValue, label) {
const raw = value ?? defaultValue;
const n = coerceInt(raw);
if (!Number.isInteger(n) || n <= 0) {
throw new ArgumentError(`indeed ${label} must be a positive integer`);
}
if (n > maxValue) {
throw new ArgumentError(`indeed ${label} must be <= ${maxValue}`);
}
return n;
}
export function requireNonNegativeInt(value, defaultValue, label) {
const raw = value ?? defaultValue;
const n = coerceInt(raw);
if (!Number.isInteger(n) || n < 0) {
throw new ArgumentError(`indeed ${label} must be a non-negative integer`);
}
return n;
}
export function requireJobKey(value) {
const id = String(value ?? '').trim().toLowerCase();
if (!id) {
throw new ArgumentError('indeed job id is required');
}View on GitHub (pinned to 49907e53dc)
Solutions
- Lower the value to at most the stated maxValue from the error message.
- If more results are needed, paginate with multiple calls (combine with start/offset) instead of one oversized limit.
- Check the CLI docs for the current cap; it may differ between versions.
Example fix
// before indeed limit 1000 // after indeed limit 50 # then paginate for more results
Defensive patterns
Strategy: validation
Validate before calling
function isValidLimit(v, max) { const n = Number(v); return Number.isInteger(n) && n > 0 && n <= max; }
if (!isValidLimit(myLimit, 50)) myLimit = 10; Type guard
function isPositiveInt(v) { return typeof v === 'number' && Number.isInteger(v) && v > 0; } Try / catch
try { const n = requireBoundedInt(value, def, max, 'limit'); } catch (e) { if (e instanceof ArgumentError) { console.error(`Bad --limit: ${value}; using default ${def}`); } else throw e; } Prevention
- Validate numeric CLI inputs in a wrapper script before invoking.
- Never interpolate unset env vars into flags; use ${VAR:?} guards.
- Prefer omitting the flag to rely on defaults.
When it happens
Trigger: Calling limit (or another bounded option) with an integer above the configured maximum, e.g. `indeed limit 1000` when maxValue is 50.
Common situations: Assuming the CLI accepts arbitrary page sizes; copying flags from another tool with higher limits; hardcoding a large batch size in an automation script.
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
- hf models limit must be <= 100
- hf spaces limit must be <= 100
- huodongxing limit must be <= ${MAX_LIMIT}
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f8e03b9a755a2650.
Report an issue: GitHub.