{"record":{"id":"460a6805a49357ab","repo":"jackwener/OpenCLI","slug":"indeed-label-cannot-be-empty","errorCode":null,"errorMessage":"indeed ${label} cannot be empty","messagePattern":"indeed (.+?) cannot be empty","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/indeed/utils.js","lineNumber":68,"sourceCode":"    }\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}\"`);\n    }\n    return v;\n}\n\nexport function requireSort(value, defaultValue = 'relevance') {\n    const v = String(value ?? defaultValue).trim().toLowerCase();\n    if (!SORT_VALUES.has(v)) {\n        throw new ArgumentError(`indeed sort must be \"relevance\" or \"date\", got \"${value}\"`);","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/indeed/utils.js#L50-L86","documentation":"requireQuery rejects empty query strings for Indeed search commands. After trimming, if the value is empty (or null/undefined coerced to ''), an ArgumentError naming the label is thrown. Search queries must contain at least one non-whitespace character.","triggerScenarios":"`indeed query \"\"` or `indeed query \"   \"`; passing an unset variable (`indeed query \"$Q\"` with Q empty); a pipeline feeding an empty string.","commonSituations":"Config/env var for the search terms missing in CI; interactive quoting mistakes producing an empty argument; a script building the query from optional inputs where all were blank.","solutions":["Provide a non-empty search query string.","Ensure the env/config variable holding the query is set before invoking.","If a broad search is intended, use a generic term like '*' or a category keyword if supported, rather than an empty string."],"exampleFix":"// before\nindeed query \"$QUERY\"   # QUERY=\"\"\n// after\nQUERY=\"software engineer\" indeed query \"$QUERY\"","handlingStrategy":"validation","validationCode":"const JK_RE = /^[0-9a-f]{16}$/; if (!JK_RE.test(jobKey)) throw new Error(`invalid jk: ${jobKey}`);","typeGuard":"function isValidJk(v) { return typeof v === 'string' && /^[0-9a-f]{16}$/.test(v); }","tryCatchPattern":"try { run(['jk', id]); } catch (e) { if (e instanceof ArgumentError && e.message.includes('not a valid jk')) { id = extractJkFromUrl(id) ?? id; return run(['jk', id]); } throw e; }","preventionTips":["Extract jk from URLs programmatically instead of pasting whole URLs.","Validate with a 16-char hex regex before invoking.","Store raw jk values, not formatted/copy-truncated ones."],"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"}