jackwener/OpenCLI · error · ArgumentError
Unsupported ${label}: ${value}
Error message
Unsupported ${label}: ${value} What it means
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.
Source
Thrown at clis/linkedin/search.js:65
hybrid: '3',
remote: '2',
};
// ── Helpers ────────────────────────────────────────────────────────────
function parseCsvArg(value) {
if (value === undefined || value === null || value === '')
return [];
return String(value)
.split(',')
.map(item => item.trim())
.filter(Boolean);
}
function mapFilterValues(input, mapping, label) {
const values = parseCsvArg(input);
const resolved = values.map(value => {
const key = value.toLowerCase();
const mapped = mapping[key];
if (!mapped)
throw new ArgumentError(`Unsupported ${label}: ${value}`);
return mapped;
});
return [...new Set(resolved)];
}
function normalizeWhitespace(value) {
return String(value ?? '').replace(/\s+/g, ' ').trim();
}
function parseIntegerArg(value, label, fallback, min, max = Infinity) {
if (value === undefined || value === null || value === '')
return fallback;
const parsed = Number(value);
if (!Number.isFinite(parsed) || !Number.isInteger(parsed)) {
throw new ArgumentError(`${label} must be an integer, got ${JSON.stringify(value)}`);
}
if (parsed < min || parsed > max) {
const range = Number.isFinite(max) ? `between ${min} and ${max}` : `at least ${min}`;
throw new ArgumentError(`${label} must be ${range}, got ${parsed}`);
}View on GitHub (pinned to 49907e53dc)
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.
Example fix
// before node cli.js linkedin search --seniority "VP of Engineering" // ArgumentError: Unsupported seniority: VP of Engineering // after node cli.js linkedin search --seniority "vp,owner,director"
Defensive patterns
Strategy: validation
Validate before calling
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(', ')}`); Type guard
function isMappedValue(v, mapping){ return typeof v === 'string' && Object.prototype.hasOwnProperty.call(mapping, v.toLowerCase()); } Try / catch
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; } Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- thread or recipient is required
- thread-or-recipient is required
- ${label} must be an integer, got ${JSON.stringify(value)}
- ${label} must be ${range}, got ${parsed}
- Unknown 12306 station telecode "${trimmed}"
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/f7679b63699666bb.
Report an issue: GitHub.