jackwener/OpenCLI · error · ArgumentError

openreview ${label} "${value}" is not a valid forum id (expe

Error message

openreview ${label} "${value}" is not a valid forum id (expected 6-20 chars of [A-Za-z0-9_-])

What it means

requireForumId throws ArgumentError when the value is present but does not match ID_PATTERN (6-20 chars of [A-Za-z0-9_-]). This catches typos, pasted URLs, or ids with slashes before a request is made. Only forum ids, not profile ids (~Name1), pass this pattern.

Source

Thrown at clis/openreview/utils.js:53

    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`);
    }
    if (!ID_PATTERN.test(id)) {
        throw new ArgumentError(`openreview ${label} "${value}" is not a valid forum id (expected 6-20 chars of [A-Za-z0-9_-])`);
    }
    return id;
}

/** OpenReview profile ids are `~...N` slugs and may include dots, hyphens, and Unicode letters. */
const PROFILE_ID_PATTERN = /^~(?=.*\p{L})[\p{L}\p{M}0-9._-]+\d+$/u;

export function requireProfileId(value, label = 'profile') {
    const id = String(value ?? '').trim();
    if (!id) {
        throw new ArgumentError(`openreview ${label} is required`);
    }
    if (!PROFILE_ID_PATTERN.test(id)) {
        throw new ArgumentError(`openreview ${label} "${value}" is not a valid profile id (expected "~First_Last1" or similar; find it on the author's openreview.net profile URL)`);
    }
    return id;
}

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Extract just the id from the URL: the last path segment of openreview.net/forum?id=<ID>.
  2. Verify the id is 6-20 chars limited to letters, digits, underscore, hyphen.
  3. For venue/invitation lookups, use the venue command (which accepts invitation ids) instead of forum.

Example fix

// before
cli forum 'https://openreview.net/forum?id=HkxJq3ZtDr'
// after
cli forum 'HkxJq3ZtDr'
Defensive patterns

Strategy: validation

Validate before calling

const ID_RE = /^[A-Za-z0-9_-]{6,20}$/;
if (!ID_RE.test(args.id)) { console.error(`invalid forum id: ${args.id}`); process.exit(2); }

Type guard

const isValidForumId = (v) => typeof v === 'string' && /^[A-Za-z0-9_-]{6,20}$/.test(v.trim());

Try / catch

try { const id = requireForumId(args.id); } catch (e) { if (e instanceof ArgumentError) { console.error(e.message); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Passing a full openreview.net URL, a forum id containing '/' or '~', an id shorter than 6 or longer than 20 chars, or an id with spaces/punctuation to id(args) or forum(args).

Common situations: Pasting the whole forum URL instead of the id segment; copying an invitation id like 'ICLR.cc/2025/Conference/-/Submission' where a forum id is expected; extra whitespace inside the value; truncating a long id.

Related errors


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