jackwener/OpenCLI · error · ArgumentError

openreview ${label} must be <= ${maxValue}

Error message

openreview ${label} must be <= ${maxValue}

What it means

After confirming the value is a positive integer, requireBoundedInt enforces the per-command maximum (e.g. author limit max 1000, search limit max 50). Exceeding it throws ArgumentError with the label and max value, preventing requests the OpenReview API would reject or that the CLI does not support.

Source

Thrown at clis/openreview/utils.js:33

/**
 * 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 = 'limit') {
    const raw = value ?? defaultValue;
    const n = coerceInt(raw);
    if (!Number.isInteger(n) || n <= 0) {
        throw new ArgumentError(`openreview ${label} must be a positive integer`);
    }
    if (n > maxValue) {
        throw new ArgumentError(`openreview ${label} must be <= ${maxValue}`);
    }
    return n;
}

export function requireNonNegativeInt(value, defaultValue, label = 'offset') {
    const raw = value ?? defaultValue;
    const n = coerceInt(raw);
    if (!Number.isInteger(n) || n < 0) {
        throw new ArgumentError(`openreview ${label} must be a non-negative integer`);
    }
    return n;
}

export function requireForumId(value, label = 'id') {
    const id = String(value ?? '').trim();
    if (!id) {
        throw new ArgumentError(`openreview ${label} is required`);
    }

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Lower the limit to the command's documented maximum (search: 50, author: 1000)
  2. Read the error message which states the exact max: 'must be <= <maxValue>'
  3. Parameterize scripts with a per-command max instead of one global page size
  4. Omit the flag to use the command default

Example fix

// before
openreview search "transformer" --limit 100
// after
openreview search "transformer" --limit 50
Defensive patterns

Strategy: validation

Validate before calling

const n = coerceInt(rawLimit);
const MAX = 50; // per-command max (author: 1000, search: 50)
if (!Number.isInteger(n) || n <= 0 || n > MAX) {
    throw new Error(`limit must be an integer between 1 and ${MAX}`);
}

Prevention

When it happens

Trigger: A limit argument is a valid positive integer but greater than the command's maxValue — e.g. --limit 100 on search (max 50) or --limit 5000 on author (max 1000).

Common situations: Copy-pasting a limit valid for one command into another with a lower cap; assuming the API allows arbitrary page sizes; scripts using a global page-size constant larger than the endpoint's max.

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/b3db15995e3935f1. Report an issue: GitHub.