{"record":{"id":"f7679b63699666bb","repo":"jackwener/OpenCLI","slug":"unsupported-label-value","errorCode":null,"errorMessage":"Unsupported ${label}: ${value}","messagePattern":"Unsupported (.+?): (.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"clis/linkedin/search.js","lineNumber":65,"sourceCode":"    hybrid: '3',\n    remote: '2',\n};\n// ── Helpers ────────────────────────────────────────────────────────────\nfunction parseCsvArg(value) {\n    if (value === undefined || value === null || value === '')\n        return [];\n    return String(value)\n        .split(',')\n        .map(item => item.trim())\n        .filter(Boolean);\n}\nfunction mapFilterValues(input, mapping, label) {\n    const values = parseCsvArg(input);\n    const resolved = values.map(value => {\n        const key = value.toLowerCase();\n        const mapped = mapping[key];\n        if (!mapped)\n            throw new ArgumentError(`Unsupported ${label}: ${value}`);\n        return mapped;\n    });\n    return [...new Set(resolved)];\n}\nfunction normalizeWhitespace(value) {\n    return String(value ?? '').replace(/\\s+/g, ' ').trim();\n}\nfunction parseIntegerArg(value, label, fallback, min, max = Infinity) {\n    if (value === undefined || value === null || value === '')\n        return fallback;\n    const parsed = Number(value);\n    if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) {\n        throw new ArgumentError(`${label} must be an integer, got ${JSON.stringify(value)}`);\n    }\n    if (parsed < min || parsed > max) {\n        const range = Number.isFinite(max) ? `between ${min} and ${max}` : `at least ${min}`;\n        throw new ArgumentError(`${label} must be ${range}, got ${parsed}`);\n    }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/linkedin/search.js#L47-L83","documentation":"mapFilterValues parses a comma-separated CLI argument, lowercases each value, and looks it up in a static mapping table of accepted names to LinkedIn filter identifiers. Any value not present in the mapping throws ArgumentError(`Unsupported ${label}: ${value}`). It exists to reject invalid filter names before building the LinkedIn search request.","triggerScenarios":"Calling a linkedin search command with a filter (e.g. seniority, function, company size, sort) whose value is misspelled, wrongly cased-relative-to-the-mapping keys, an alias the mapping lacks, or a comma list containing one bad entry (the whole call fails).","commonSituations":"Typos like 'senoirity=owner'; using human labels ('VP of Engineering') where the mapping expects canonical keys; copying filter values from a different tool/version whose vocabulary changed; extra whitespace or stray commas producing empty tokens.","solutions":["Use one of the accepted values listed in the command's help / the mapping table for that label.","Check spelling and strip whitespace; keys are matched after lowercasing only.","Replace human-readable labels with the canonical mapping key (e.g. 'director','owner').","If a genuinely new value is needed, add it to the mapping table in clis/linkedin/search.js."],"exampleFix":"// before\nnode cli.js linkedin search --seniority \"VP of Engineering\"\n// ArgumentError: Unsupported seniority: VP of Engineering\n// after\nnode cli.js linkedin search --seniority \"vp,owner,director\"","handlingStrategy":"validation","validationCode":"const allowed = Object.keys(mapping); const bad = parseCsvArg(input).filter(v => !allowed.includes(v.toLowerCase())); if (bad.length) throw new Error(`Unsupported ${label}: ${bad.join(', ')}; allowed: ${allowed.join(', ')}`);","typeGuard":"function isMappedValue(v, mapping){ return typeof v === 'string' && Object.prototype.hasOwnProperty.call(mapping, v.toLowerCase()); }","tryCatchPattern":"try { await search(opts) } catch (e) { if (e instanceof ArgumentError && /Unsupported /.test(e.message)) { console.error(e.message + ' - see --help for allowed values'); } else throw e; }","preventionTips":["Keep a copy of each command's allowed filter values next to your calling code.","Validate filter CSVs against the mapping before invoking.","Avoid free-text labels; use canonical mapping keys.","Watch for vocabulary changes when upgrading the CLI."],"tags":["argument-error","invalid-value","linkedin","filter-mapping"],"backgroundTag":"invalid-enum-value","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}