jackwener/OpenCLI · error · ArgumentError
indeed fromage must be one of 1/3/7/14 (days), got "${value}
Error message
indeed fromage must be one of 1/3/7/14 (days), got "${value}" What it means
requireFromage restricts the date-posted filter to Indeed's accepted fromage values: exactly '1', '3', '7', or '14' (days). Any other value, including other numbers or unit-suffixed strings like '7d', throws an ArgumentError. Empty/undefined returns '' (filter omitted).
Source
Thrown at clis/indeed/utils.js:78
throw new ArgumentError(`indeed job id "${value}" is not a valid jk (expected 16-char lowercase hex)`);
}
return id;
}
export function requireQuery(value, label = 'query') {
const q = String(value ?? '').trim();
if (!q) {
throw new ArgumentError(`indeed ${label} cannot be empty`);
}
return q;
}
/** "1" / "3" / "7" / "14" — accepted by Indeed's `fromage` filter. */
export function requireFromage(value) {
if (value === undefined || value === null || value === '') return '';
const v = String(value).trim();
if (!FROMAGE_VALUES.has(v)) {
throw new ArgumentError(`indeed fromage must be one of 1/3/7/14 (days), got "${value}"`);
}
return v;
}
export function requireSort(value, defaultValue = 'relevance') {
const v = String(value ?? defaultValue).trim().toLowerCase();
if (!SORT_VALUES.has(v)) {
throw new ArgumentError(`indeed sort must be "relevance" or "date", got "${value}"`);
}
return v;
}
/**
* Build an Indeed search URL with only the user-supplied filters set.
* Indeed treats absent params as defaults; we never pass empty strings
* because the page will echo them back into the query and the URL
* stays cleaner for round-tripping.
*/View on GitHub (pinned to 49907e53dc)
Solutions
- Use one of the allowed values: 1, 3, 7, or 14.
- Map desired ranges to the nearest supported value (e.g. 30 days → 14, the widest supported).
- Omit the flag entirely for no date filter.
Example fix
// before indeed fromage 30 // after indeed fromage 14
Defensive patterns
Strategy: validation
Validate before calling
const q = String(query ?? '').trim(); if (!q) throw new Error('query must be non-empty'); Type guard
function hasQuery(v) { return typeof v === 'string' && v.trim().length > 0; } Try / catch
try { run(['search', q]); } catch (e) { if (e instanceof ArgumentError && e.message.includes('cannot be empty')) { console.error('Search query is required'); process.exitCode = 2; } else throw e; } Prevention
- Require query env vars with ${QUERY:?}.
- Trim and check inputs before invoking.
- Fail fast in CI when config for search terms is missing.
When it happens
Trigger: `indeed fromage 30`, `fromage 7d`, `fromage last week`, or `fromage 24h` — any string not in {1,3,7,14}.
Common situations: Confusing this with other APIs' arbitrary day counts (e.g. 30 days); adding units; translating 'last 24 hours' into 1h instead of 1.
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
- indeed sort must be "relevance" or "date", got "${value}"
- zhihu search --type must be one of: ${TYPES.join(', ')}
- <train-no> "${trainNo}" does not look like a 12306 internal
- --from station must not be empty
- --to station must not be empty
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/29a5d4361be0218f.
Report an issue: GitHub.