jackwener/OpenCLI · error · ArgumentError

indeed ${label} cannot be empty

Error message

indeed ${label} cannot be empty

What it means

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.

Source

Thrown at clis/indeed/utils.js:68

    }
    return n;
}

export function requireJobKey(value) {
    const id = String(value ?? '').trim().toLowerCase();
    if (!id) {
        throw new ArgumentError('indeed job id is required');
    }
    if (!JK_PATTERN.test(id)) {
        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}"`);

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Provide a non-empty search query string.
  2. Ensure the env/config variable holding the query is set before invoking.
  3. If a broad search is intended, use a generic term like '*' or a category keyword if supported, rather than an empty string.

Example fix

// before
indeed query "$QUERY"   # QUERY=""
// after
QUERY="software engineer" indeed query "$QUERY"
Defensive patterns

Strategy: validation

Validate before calling

const JK_RE = /^[0-9a-f]{16}$/; if (!JK_RE.test(jobKey)) throw new Error(`invalid jk: ${jobKey}`);

Type guard

function isValidJk(v) { return typeof v === 'string' && /^[0-9a-f]{16}$/.test(v); }

Try / catch

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; }

Prevention

When it happens

Trigger: `indeed query ""` or `indeed query " "`; passing an unset variable (`indeed query "$Q"` with Q empty); a pipeline feeding an empty string.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/460a6805a49357ab. Report an issue: GitHub.