{"record":{"id":"ac38ade6459ead16","repo":"jackwener/OpenCLI","slug":"invalid-jobtype-input","errorCode":null,"errorMessage":"Invalid jobType: ${input}","messagePattern":"Invalid jobType: (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/boss/search.js","lineNumber":85,"sourceCode":"function resolveMap(input, map) {\n    if (!input)\n        return '';\n    if (map[input] !== undefined)\n        return map[input];\n    for (const [key, val] of Object.entries(map)) {\n        if (key.includes(input))\n            return val;\n    }\n    return input;\n}\nfunction resolveJobType(input) {\n    if (!input)\n        return '';\n    if (JOB_TYPE_MAP[input] !== undefined)\n        return JOB_TYPE_MAP[input];\n    if (JOB_TYPE_CODES.has(input))\n        return input;\n    throw new ArgumentError(`Invalid jobType: ${input}`, 'Use one of: 全职, 兼职, 实习, 不限');\n}\nfunction formatBossOnline(value) {\n    if (value === true)\n        return 'Y';\n    if (value === false)\n        return 'N';\n    return '';\n}\nasync function captureJobList(page, url) {\n    if (typeof page.startNetworkCapture !== 'function' ||\n        typeof page.readNetworkCapture !== 'function' ||\n        !await page.startNetworkCapture('joblist.json')) {\n        throw new CommandExecutionError('BOSS search requires CDP network capture');\n    }\n    await page.readNetworkCapture();\n    for (let attempt = 0; attempt < 2; attempt++) {\n        const separator = url.includes('?') ? '&' : '?';\n        await navigateTo(page, `${url}${separator}_opencli=${Date.now()}`, 5);","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/boss/search.js#L67-L103","documentation":"resolveJobType validates the jobType filter for BOSS search. Only the literals 全职, 兼职, 实习, 不限 (or their already-resolved numeric codes 1901/1903/1902/0) are accepted; any other value raises this ArgumentError. Empty/omitted input returns '' (no filter).","triggerScenarios":"Passing jobType values like 'full-time', '正式', '合同工', or a numeric code not in JOB_TYPE_MAP to the jobType parameter of boss search.","commonSituations":"Translating enum values from another job API into this one; passing codes from a different BOSS enumeration; localization mistakes; assuming synonyms like '正式工' map automatically.","solutions":["Use exactly one of: 全职, 兼职, 实习, 不限","Or pass one of the valid numeric codes: 1901 (全职), 1903 (兼职), 1902 (实习), 0 (不限)","Omit the jobType parameter entirely if no filter is wanted","Cross-check JOB_TYPE_MAP in clis/boss/search.js for the accepted values"],"exampleFix":"// before\nawait cli('boss', 'search', { jobType: 'full-time' });\n// after\nawait cli('boss', 'search', { jobType: '全职' });","handlingStrategy":"validation","validationCode":"const JOB_TYPES = ['不限', '全职', '兼职', '实习'];\nif (input !== undefined && input !== '' && !JOB_TYPES.includes(input)) {\n  throw new Error(`jobType must be one of ${JOB_TYPES.join(', ')}`);\n}","typeGuard":"const isJobType = (v) => typeof v === 'string' && ['不限','全职','兼职','实习','1901','1902','1903','0'].includes(v);","tryCatchPattern":"try {\n  return await cli('boss', 'search', { jobType: input });\n} catch (e) {\n  if (String(e.message).startsWith('Invalid jobType')) {\n    console.warn(`bad jobType \"${input}\"; searching without type filter`);\n    return cli('boss', 'search', {});\n  }\n  throw e;\n}","preventionTips":["Keep a constant list of allowed jobType literals in your app","Map external enums to 全职/兼职/实习/不限 before calling","Omit jobType instead of passing guesses","Document accepted values wherever the option is exposed"],"tags":["argument-validation","enum-value","boss-zhipin"],"backgroundTag":"invalid-argument-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}