jackwener/OpenCLI · error · ArgumentError

indeed job id "${value}" is not a valid jk (expected 16-char

Error message

indeed job id "${value}" is not a valid jk (expected 16-char lowercase hex)

What it means

requireJobKey validates the job key's format against JK_PATTERN: it must be exactly 16 lowercase hexadecimal characters (Indeed's jk format). Values that don't match — wrong length, uppercase, non-hex characters, or a full job URL pasted instead of the key — raise this ArgumentError.

Source

Thrown at clis/indeed/utils.js:60

    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');
    }
    if (!JK_PATTERN.test(id)) {
        throw new ArgumentError(`indeed job id "${value}" is not a valid jk (expected 16-char lowercase hex)`);
    }
    return id;
}

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

/** "1" / "3" / "7" / "14" — accepted by Indeed's `fromage` filter. */
export function requireFromage(value) {
    if (value === undefined || value === null || value === '') return '';
    const v = String(value).trim();
    if (!FROMAGE_VALUES.has(v)) {
        throw new ArgumentError(`indeed fromage must be one of 1/3/7/14 (days), got "${value}"`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Extract the 16-char hex jk from the job URL (the value of the jk= query parameter) and pass only that.
  2. Verify the ID is exactly 16 characters of [0-9a-f].
  3. Re-fetch the job key from the search command output if the ID came from another system.

Example fix

// before
indeed jk "https://www.indeed.com/viewjob?jk=1a2b3c4d5e6f7a8b"
// after
indeed jk "1a2b3c4d5e6f7a8b"
Defensive patterns

Strategy: validation

Validate before calling

if (!jobKey || !String(jobKey).trim()) throw new Error('job key required before calling jk command');

Type guard

function hasJobKey(v) { return typeof v === 'string' && v.trim().length > 0; }

Try / catch

try { run(['jk', jobKey]); } catch (e) { if (e instanceof ArgumentError && e.message.includes('required')) { console.error('Provide a job key: indeed jk <16-char hex>'); process.exitCode = 2; } else throw e; }

Prevention

When it happens

Trigger: Passing a full Indeed job URL instead of the raw jk; passing an ID from another source with different length; an ID containing uppercase hex (unless it was lowercased — the function lowercases, so mostly length/charset issues); truncated/copied-partial IDs.

Common situations: Copying the URL from the browser and forgetting to extract the jk query param; Excel/spreadsheet tools stripping leading characters; mixing up job IDs from other job boards.

Related errors


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