{"record":{"id":"8d83200edb1a2460","repo":"jackwener/OpenCLI","slug":"pinterest-search-pins","errorCode":null,"errorMessage":"pinterest search-pins","messagePattern":"pinterest search-pins","errorType":"exception","errorClass":"EmptyResultError","httpStatus":null,"severity":"warning","filePath":"clis/pinterest/search-pins.js","lineNumber":39,"sourceCode":"  func: async (page, kwargs) => {\n    const query = String(kwargs.query ?? '').trim();\n    if (!query) throw new ArgumentError('query is required');\n\n    const limit = requireLimit(kwargs.limit, { fallback: DEFAULT_LIMIT, max: MAX_LIMIT });\n    const sourceUrl = `/search/pins/?q=${encodeURIComponent(query)}`;\n\n    await page.goto(`${PINTEREST_BASE}${sourceUrl}`);\n\n    const rows = await collectPins(page, {\n      resource: 'BaseSearchResource',\n      baseOptions: { query, scope: 'pins', appliedProductFilters: '---', auto_correction_disabled: false },\n      sourceUrl,\n      limit,\n      pageSize: DEFAULT_PAGE_SIZE,\n    });\n\n    if (rows.length === 0) {\n      throw new EmptyResultError('pinterest search-pins', `no pins found for \"${query}\"`);\n    }\n    return rows;\n  },\n});\n","sourceCodeStart":21,"sourceCodeEnd":44,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/pinterest/search-pins.js#L21-L44","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Broaden or correct the search keyword and confirm results appear manually in a browser","Re-run with a higher --limit and after a delay to rule out transient empty renders","Catch EmptyResultError in your automation and fall back to an alternative keyword or mark the result as empty"],"exampleFix":"// before\nconst pins = await pinterest.searchPins({ query: 'q' }); // single-char, no results\n// after\ntry {\n  const pins = await pinterest.searchPins({ query: 'quinoa salad recipe' });\n} catch (e) {\n  if (e.name === 'EmptyResultError') return null;\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (!query || !query.trim()) throw new Error('pre-check: empty query will fail validation anyway');","typeGuard":null,"tryCatchPattern":"try { pins = await pinterest.searchPins({ query }); }\ncatch (e) {\n  if (e.name === 'EmptyResultError') return { pins: [], query };\n  throw e;\n}","preventionTips":["Prefer specific multi-word queries over single characters","Add retry/backoff around scrapes — empty grids can be transient","Log the query alongside the empty result to distinguish bad keywords from scraper breakage"],"tags":["empty-results","scraping","no-data"],"backgroundTag":"empty-result-set","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}