{"record":{"id":"25ee9d4aec46f2b0","repo":"jackwener/OpenCLI","slug":"indeed-job-id-value-is-not-a-valid-jk-expect","errorCode":null,"errorMessage":"indeed job id \"${value}\" is not a valid jk (expected 16-char lowercase hex)","messagePattern":"indeed job id \"(.+?)\" is not a valid jk \\(expected 16-char lowercase hex\\)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/indeed/utils.js","lineNumber":60,"sourceCode":"    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 '';\n    const v = String(value).trim();\n    if (!FROMAGE_VALUES.has(v)) {\n        throw new ArgumentError(`indeed fromage must be one of 1/3/7/14 (days), got \"${value}\"`);","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/indeed/utils.js#L42-L78","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Extract the 16-char hex jk from the job URL (the value of the jk= query parameter) and pass only that.","Verify the ID is exactly 16 characters of [0-9a-f].","Re-fetch the job key from the search command output if the ID came from another system."],"exampleFix":"// before\nindeed jk \"https://www.indeed.com/viewjob?jk=1a2b3c4d5e6f7a8b\"\n// after\nindeed jk \"1a2b3c4d5e6f7a8b\"","handlingStrategy":"validation","validationCode":"if (!jobKey || !String(jobKey).trim()) throw new Error('job key required before calling jk command');","typeGuard":"function hasJobKey(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"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; }","preventionTips":["Guard shell variables with ${JOB_ID:?unset}.","Check upstream search results are non-empty before chaining into jk.","Validate args in wrapper scripts."],"tags":["cli","format-validation","job-key"],"backgroundTag":"invalid-format","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}