jackwener/OpenCLI · warning · EmptyResultError

No Upwork jobs matched "${query}"${location ? ` in ${locatio

Error message

No Upwork jobs matched "${query}"${location ? ` in ${location}` : ''}

What it means

An EmptyResultError raised when the search completed successfully but zero jobs matched the query (and optional location filter). This is the library's normal signal for a valid search with no hits, not a malfunction. The query text and location are interpolated into the message.

Source

Thrown at clis/upwork/search.js:105

        if (payload?.onLogin) {
            throw new AuthRequiredError('upwork.com', 'Upwork redirected to login. Open https://www.upwork.com in the connected browser and sign in, then retry.');
        }
        if (payload?.challenge) {
            throw new CommandExecutionError('Upwork served a Cloudflare challenge page', 'Open https://www.upwork.com in the connected browser and clear the challenge, then retry.');
        }
        if (!payload?.ready) {
            throw new CommandExecutionError('Upwork search state (window.__NUXT__.state.jobsSearch) was not present within 15s', 'The page may not have finished hydrating, or the SSR state shape may have changed.');
        }
        if (!isPlainObject(payload)) {
            throw new CommandExecutionError('Upwork search returned an unexpected Browser Bridge payload shape');
        }
        if (!payload.jobsPresent || !Array.isArray(payload.jobs)) {
            throw new CommandExecutionError('Upwork search state had an unexpected jobs shape; expected window.__NUXT__.state.jobsSearch.jobs to be an array.');
        }

        const jobs = payload.jobs;
        if (jobs.length === 0) {
            throw new EmptyResultError('upwork search', `No Upwork jobs matched "${query}"${location ? ` in ${location}` : ''}`);
        }

        const offset = (pageNum - 1) * perPage;
        const rows = jobsToListRows(jobs, { offset, limit: perPage });
        if (rows.length === 0) {
            throw new CommandExecutionError('Upwork search results did not include any job with a valid ciphertext id; cannot produce round-trippable detail rows.');
        }
        return rows;
    },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with broader or fewer search terms.
  2. Drop or generalize the location filter.
  3. Check the query for typos and use terms that appear in real Upwork job titles.
  4. Browse upwork.com manually with the same query to confirm there really are no matches before treating it as a CLI bug.

Example fix

// before
await cli.search('cobol blockchain quantum widget') // EmptyResultError
// after
await cli.search('blockchain developer') // broader query
// or catch and fall back:
try { await cli.search(query) } catch (e) { if (e instanceof EmptyResultError) return []; throw e; }
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check the query before searching
const q = query.trim();
if (!q) throw new Error('Query required');
if (q.split(/\s+/).length > 8) console.warn('Very specific query may return zero results');

Type guard

function isEmptySearch(jobs) {
  return Array.isArray(jobs) && jobs.length === 0;
}

Try / catch

try {
  rows = await cli.search(query);
} catch (e) {
  if (e.name === 'EmptyResultError' || String(e.message).startsWith('No Upwork jobs matched')) {
    return []; // legitimately no matches - handle as empty, not failure
  } else throw e;
}

Prevention

When it happens

Trigger: Calling upwork search with a query string (or query+location combination) that returns an empty jobs array in window.__NUXT__.state.jobsSearch.jobs.

Common situations: Overly specific queries or exotic skill keywords; a location filter with no matching openings; typos in the query; searching a niche category at an off time; region-restricted results where the query has no local listings.

Related errors


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