{"record":{"id":"55227168ce139cb7","repo":"jackwener/OpenCLI","slug":"indeed-job-id-is-required","errorCode":null,"errorMessage":"indeed job id is required","messagePattern":"indeed job id is required","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/indeed/utils.js","lineNumber":57,"sourceCode":"    if (n > maxValue) {\n        throw new ArgumentError(`indeed ${label} must be <= ${maxValue}`);\n    }\n    return n;\n}\n\nexport function requireNonNegativeInt(value, defaultValue, label) {\n    const raw = value ?? defaultValue;\n    const n = coerceInt(raw);\n    if (!Number.isInteger(n) || n < 0) {\n        throw new ArgumentError(`indeed ${label} must be a non-negative integer`);\n    }\n    return n;\n}\n\nexport function requireJobKey(value) {\n    const id = String(value ?? '').trim().toLowerCase();\n    if (!id) {\n        throw new ArgumentError('indeed job id is required');\n    }\n    if (!JK_PATTERN.test(id)) {\n        throw new ArgumentError(`indeed job id \"${value}\" is not a valid jk (expected 16-char lowercase hex)`);\n    }\n    return id;\n}\n\nexport function requireQuery(value, label = 'query') {\n    const q = String(value ?? '').trim();\n    if (!q) {\n        throw new ArgumentError(`indeed ${label} cannot be empty`);\n    }\n    return q;\n}\n\n/** \"1\" / \"3\" / \"7\" / \"14\" — accepted by Indeed's `fromage` filter. */\nexport function requireFromage(value) {\n    if (value === undefined || value === null || value === '') return '';","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/indeed/utils.js#L39-L75","documentation":"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.","triggerScenarios":"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).","commonSituations":"Shell variable not exported or misspelled in scripts; piping an empty lookup result straight into the jk command; forgetting the argument when invoking interactively.","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)."],"exampleFix":"// before\nindeed jk \"$JOB_ID\"      # JOB_ID empty\n// after\n: \"${JOB_ID:?JOB_ID must be set}\" && indeed jk \"$JOB_ID\"","handlingStrategy":"validation","validationCode":"const n = Number(v); if (!(Number.isInteger(n) && n >= 0)) v = 0;","typeGuard":"function isNonNegativeInt(v) { return Number.isInteger(v) && v >= 0; }","tryCatchPattern":"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; }","preventionTips":["Clamp pagination counters with Math.max(0, offset).","Sanitize numeric inputs parsed from strings with parseInt(radix).","Add unit tests for pagination edge cases."],"tags":["cli","missing-argument","input-error"],"backgroundTag":"missing-required-argument","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}