jackwener/OpenCLI · error · ArgumentError
must be >= ${min}
Error message
must be >= ${min} What it means
ArgumentError thrown by normalizeInteger when an integer option is below its configured minimum. Each option (limit, offset, maxScrolls, pageScrolls, pageTimeoutMs, delayMinMs) carries a min bound; negative or too-small values are rejected before the scrape starts.
Source
Thrown at clis/grok/export-all.js:19
import { cli, Strategy } from '@jackwener/opencli/registry';
import { ArgumentError, AuthRequiredError, EmptyResultError, TimeoutError } from '@jackwener/opencli/errors';
import fs from 'node:fs';
import {
normalizeConversationRows,
normalizeManifestRows,
requireBooleanEvaluateResult,
requireObjectEvaluateResult,
} from './export-utils.js';
import { GROK_DOMAIN, GROK_URL } from './utils.js';
function normalizeInteger(value, defaultValue, label, { min = 0, max = Number.MAX_SAFE_INTEGER } = {}) {
const raw = value ?? defaultValue;
const n = Number(raw);
if (!Number.isInteger(n)) {
throw new ArgumentError(label, `must be an integer`);
}
if (n < min) {
throw new ArgumentError(label, `must be >= ${min}`);
}
if (n > max) {
throw new ArgumentError(label, `must be <= ${max}`);
}
return n;
}
async function waitRandom(page, minMs, maxMs) {
if (maxMs <= 0) return;
const span = Math.max(0, maxMs - minMs);
const ms = minMs + Math.floor(Math.random() * (span + 1));
if (ms > 0) await page.wait(ms / 1000);
}
function readManifest(manifestPath, { offset, limit }) {
const path = String(manifestPath || '').trim();
if (!path) return null;
let parsed;View on GitHub (pinned to 49907e53dc)
Solutions
- Clamp the value with Math.max(min, value) before calling
- Use 0 or the documented minimum for offset/limit
- Check your offset pagination math for sign errors
- Inspect each option's min bound and supply a compliant value
Example fix
// before
cli.exportAll({ offset: -1 });
// after
cli.exportAll({ offset: Math.max(0, computedOffset) }); Defensive patterns
Strategy: validation
Validate before calling
function clampMin(n, min) { if (n < min) throw new Error(`value ${n} must be >= ${min}`); return n; } Type guard
const isIntGte = (v, min) => Number.isInteger(v) && v >= min;
Try / catch
try { await cli.exportAll(opts); } catch (e) { if (e.name === 'ArgumentError' && />= /.test(e.message)) { console.error(`Below minimum: ${e.message}`); } else throw e; } Prevention
- Clamp computed values with Math.max(min, v)
- Re-check pagination arithmetic for negative offsets
- Use 0 for 'no offset' instead of negative sentinels
- Validate options against documented min bounds before calls
When it happens
Trigger: Passing a value < min to any validated option, e.g. offset=-1, maxScrolls=-5, or a below-minimum pageTimeoutMs/delayMinMs.
Common situations: Negative offsets computed as prevOffset-offset without clamping; scripts computing timeouts from metrics that can be 0/negative; typos like --offset=-10.
Related errors
- must be <= ${max}
- archive snapshots url cannot be empty
- archive snapshots limit must be a positive integer
- archive snapshots limit must be <= 1000
- archive snapshots ${key} must be a digit-only timestamp (YYY
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/2b801967532f83de.
Report an issue: GitHub.