jackwener/OpenCLI · warning · EmptyResultError

pinterest search-boards

Error message

pinterest search-boards

What it means

EmptyResultError from pinterest search-boards: Pinterest returned no board rows for the given keyword after collecting results up to the requested limit. The library throws this instead of silently returning an empty array so callers can distinguish 'no matches' from a successful empty query.

Source

Thrown at clis/pinterest/search-boards.js:50

      sourceUrl,
      limit,
      keyField: 'boardId',
      pageSize: DEFAULT_PAGE_SIZE,
      mapItem: (board) => {
        if (!board || board.type !== 'board' || !board.id) return null;
        return {
          boardId: String(board.id),
          name: board.name || '',
          pinCount: typeof board.pin_count === 'number' ? board.pin_count : 0,
          owner: (board.owner && board.owner.username) || '',
          description: (board.description || '').trim(),
          url: board.url ? `${PINTEREST_BASE}${board.url}` : '',
        };
      },
    });

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

View on GitHub (pinned to 49907e53dc)

Solutions

  1. Retry with a broader or corrected keyword (drop filters, use common terms)
  2. Increase --limit in case results load late, and verify the query renders results on pinterest.com in a browser
  3. Handle the empty case in your script: catch EmptyResultError and treat it as 'no data' rather than a crash

Example fix

// before
const boards = await pinterest.searchBoards({ query: 'xzqvbnonsense' }); // throws
// after
try {
  const boards = await pinterest.searchBoards({ query: 'home decor' });
} catch (e) {
  if (e.name === 'EmptyResultError') return [];
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (typeof query !== 'string' || !query.trim()) throw new Error('pre-check: query must be a non-empty string');

Try / catch

try { rows = await run('pinterest search-boards', [query]); }
catch (e) {
  if (e.name === 'EmptyResultError') return [];
  throw e;
}

Prevention

When it happens

Trigger: A valid non-empty query whose /search/boards/ scrape yields zero rows within the limit — e.g. a gibberish keyword, an extremely niche term, or Pinterest serving an empty/consent wall page the scraper could not extract boards from.

Common situations: Typo in the search term, searching for a keyword with no public boards, region/language settings returning an empty results grid, or Pinterest A/B layouts changing DOM selectors so extraction finds nothing.

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/a141aa6a9a03a8e5. Report an issue: GitHub.