jackwener/OpenCLI · error · ArgumentError

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

Error message

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

What it means

Thrown by requireBoundedInt when the value coerces to a positive integer but exceeds the allowed maximum for that option (e.g. limit > 100 for search/venue). It caps request sizes to keep dblp responses reasonable.

Source

Thrown at clis/dblp/utils.js:99

export async function dblpFetchXml(path, label) {
    const res = await dblpFetch(`${DBLP_ORIGIN}${path}`, label, 'application/xml');
    return res.text();
}

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(`dblp ${label} must be a positive integer`);
    }
    if (n > maxValue) {
        throw new ArgumentError(`dblp ${label} must be <= ${maxValue}`);
    }
    return n;
}

export function requireQuery(value, label = 'query') {
    const q = String(value ?? '').trim();
    if (!q) {
        throw new ArgumentError(`dblp ${label} cannot be empty`);
    }
    return q;
}

export function requireRecordKey(value) {
    const key = String(value ?? '').trim();
    if (!key) {
        throw new ArgumentError('dblp paper key is required');
    }
    if (!KEY_PATTERN.test(key)) {

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Lower the value to at most the maximum (e.g. --limit 100)
  2. Read the command's help to see its specific max
  3. Paginate multiple smaller requests instead of one huge request
  4. Remove the flag to use the built-in default

Example fix

// before
node cli.js dblp search --limit 500
// after
node cli.js dblp search --limit 100
Defensive patterns

Strategy: validation

Validate before calling

function clampLimit(raw, def = 20, max = 100) {
  if (raw === undefined || raw === null || raw === '') return def;
  const n = Number(raw);
  if (!Number.isInteger(n) || n <= 0) throw new Error(`--limit must be a positive integer, got "${raw}"`);
  return Math.min(n, max);
}

Type guard

function isWithinBound(v, max) { return typeof v === 'number' && Number.isInteger(v) && v > 0 && v <= max; }

Try / catch

try {
  runDblpSearch(args);
} catch (err) {
  if (/must be <= \d+/.test(err.message)) {
    console.error('Lower --limit (search/venue allow at most 100)');
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Calling a dblp command with --limit 500 when the command's maxValue is 100, or any value above the command-specific cap.

Common situations: Assuming the limit is unbounded; copying a limit from another command with a higher cap; scripts computing page sizes larger than dblp's supported h= maximum.

Related errors


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