jackwener/OpenCLI · warning · EmptyResultError

pinterest search-pins

Error message

pinterest search-pins

What it means

EmptyResultError from pinterest search-pins: the /search/pins/ page yielded no pin rows for the keyword within the configured limit/pageSize. The library signals 'no matches' explicitly rather than returning [] so callers can branch on it.

Source

Thrown at clis/pinterest/search-pins.js:39

  func: async (page, kwargs) => {
    const query = String(kwargs.query ?? '').trim();
    if (!query) throw new ArgumentError('query is required');

    const limit = requireLimit(kwargs.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });
    const sourceUrl = `/search/pins/?q=${encodeURIComponent(query)}`;

    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);

    const rows = await collectPins(page, {
      resource: 'BaseSearchResource',
      baseOptions: { query, scope: 'pins', appliedProductFilters: '---', auto_correction_disabled: false },
      sourceUrl,
      limit,
      pageSize: DEFAULT_PAGE_SIZE,
    });

    if (rows.length === 0) {
      throw new EmptyResultError('pinterest search-pins', `no pins found for "${query}"`);
    }
    return rows;
  },
});

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Broaden or correct the search keyword and confirm results appear manually in a browser
  2. Re-run with a higher --limit and after a delay to rule out transient empty renders
  3. Catch EmptyResultError in your automation and fall back to an alternative keyword or mark the result as empty

Example fix

// before
const pins = await pinterest.searchPins({ query: 'q' }); // single-char, no results
// after
try {
  const pins = await pinterest.searchPins({ query: 'quinoa salad recipe' });
} catch (e) {
  if (e.name === 'EmptyResultError') return null;
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!query || !query.trim()) throw new Error('pre-check: empty query will fail validation anyway');

Try / catch

try { pins = await pinterest.searchPins({ query }); }
catch (e) {
  if (e.name === 'EmptyResultError') return { pins: [], query };
  throw e;
}

Prevention

When it happens

Trigger: A syntactically valid query where the scraped results grid is empty: misspelled or ultra-specific keywords, or a page state (login wall, region restriction, changed markup) where collectResults finds zero matching rows.

Common situations: Pinterest showing a consent or login interstitial to the automation browser, keyword has no indexed pins, scraper selectors outdated after a Pinterest DOM update, or heavy rate-limiting returning blank grids.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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