jackwener/OpenCLI · warning · EmptyResultError

No Yahoo results matched "${query}".

Error message

No Yahoo results matched "${query}".

What it means

The Yahoo search page was scraped successfully but the extractor returned zero usable rows, so the CLI throws emptySearchResults to signal that the query genuinely produced no results (or the page layout broke extraction). Thrown before any rows are built.

Source

Thrown at clis/yahoo/search.js:80

  ],
  columns: ['rank', 'title', 'url', 'snippet'],
  func: async (page, kwargs) => {
    const limit = requireBoundedInteger(kwargs.limit, 7, 1, 7, '--limit');
    const query = requireSearchQuery(kwargs.keyword);
    const keyword = encodeURIComponent(query);
    const pageNum = requireBoundedInteger(kwargs.page, 1, 1, 100, '--page');
    var url = `https://search.yahoo.com/search?p=${keyword}`;
    if (pageNum > 1) url += `&b=${(pageNum - 1) * 7 + 1}`;
    await runBrowserStep('yahoo search navigation', () => page.goto(url));
    try {
      await page.wait({ selector: '.algo', timeout: 10 });
    } catch {
      await page.wait(3).catch(function() {});
    }
    const raw = await runBrowserStep('yahoo search extraction', () => page.evaluate(buildExtractorJs(limit)));
    const results = requireRows(raw, 'yahoo search');
    if (results.length === 0) {
      throw emptySearchResults('Yahoo', query);
    }
    const rows = results
      .map(function(r, index) {
        return { rank: index + 1 + (pageNum - 1) * 7, title: r[0], url: decodeYahooUrl(r[1]), snippet: r[2] };
      })
      .filter((row) => row.url);
    if (rows.length === 0) throw emptySearchResults('Yahoo', query);
    return rows;
  },
});

export const __test__ = { command };

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a broader or correctly-spelled query
  2. Retry later or from a different network/region in case Yahoo served an anti-bot or consent interstitial
  3. Check the extractor selectors against current Yahoo DOM if all queries now return empty
  4. Reduce --limit or check pagination parameters so the requested page exists

Example fix

// before: failing hard on empty results
const rows = requireRows(raw, 'yahoo search');
if (rows.length === 0) throw emptySearchResults('Yahoo', query);
// after: caller-side graceful handling
try {
  const rows = await yahooSearch(query);
} catch (e) {
  if (/No Yahoo results/.test(e.message)) return [];
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// no pre-call validation possible; optionally pre-check query non-empty
if (!query || !query.trim()) throw new Error('Query must be non-empty');

Type guard

function hasResults(raw) {
  return Array.isArray(raw) && raw.length > 0;
}

Try / catch

try {
  const rows = await yahooSearch(query, limit);
} catch (e) {
  if (e instanceof EmptySearchResultError || /No Yahoo results/.test(e.message)) return [];
  throw e;
}

Prevention

When it happens

Trigger: Running the yahoo search command when page.evaluate(buildExtractorJs) returns an empty array for the given query and page number.

Common situations: Very obscure or nonsense query with no Yahoo results; heavy result filtering; Yahoo serving a consent/anti-bot page that renders no result nodes; region-restricted results.

Related errors


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