jackwener/OpenCLI · error · ArgumentError
indeed job id is required
Error message
indeed job id is required
What it means
requireJobKey requires a non-empty Indeed job key (jk) string. Empty, null, or whitespace-only values are rejected with an ArgumentError. The value is trimmed and lowercased before further validation in requireJobKey.
Source
Thrown at clis/indeed/utils.js:57
if (n > maxValue) {
throw new ArgumentError(`indeed ${label} must be <= ${maxValue}`);
}
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 '';View on GitHub (pinned to 49907e53dc)
Solutions
- Supply the 16-character job key as the argument.
- Check that the shell variable feeding the command is set and non-empty (`: "${JOB_ID:?}"`).
- Fix the upstream step that should have produced the job key (e.g. a search whose results were empty).
Example fix
// before
indeed jk "$JOB_ID" # JOB_ID empty
// after
: "${JOB_ID:?JOB_ID must be set}" && indeed jk "$JOB_ID" Defensive patterns
Strategy: validation
Validate before calling
const n = Number(v); if (!(Number.isInteger(n) && n >= 0)) v = 0;
Type guard
function isNonNegativeInt(v) { return Number.isInteger(v) && v >= 0; } Try / catch
try { const n = requireNonNegativeInt(value, 0, 'start'); } catch (e) { if (e instanceof ArgumentError) { console.error('start must be a non-negative integer; defaulting to 0'); return 0; } throw e; } Prevention
- Clamp pagination counters with Math.max(0, offset).
- Sanitize numeric inputs parsed from strings with parseInt(radix).
- Add unit tests for pagination edge cases.
When it happens
Trigger: Calling the jk-based command with a missing positional arg, an empty string, or an expression that yields null/undefined (e.g. `indeed jk "$JOB_ID"` with JOB_ID unset).
Common situations: Shell variable not exported or misspelled in scripts; piping an empty lookup result straight into the jk command; forgetting the argument when invoking interactively.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- indeed ${label} cannot be empty
- keyword must not be empty
- <from> station must not be empty
- <to> station must not be empty
- tid must be a numeric thread id
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/55227168ce139cb7.
Report an issue: GitHub.