jackwener/OpenCLI · error · CliError
NOT_FOUND
NOT_FOUND
Error message
No search results found
What it means
The google search CLI command executes an in-page wrapper script (browser evaluate) and throws this CliError with code NOT_FOUND when the extracted results array is empty. The hint 'Try a different keyword or check for CAPTCHA' reflects that empty extraction usually means either a genuinely resultless query or Google showing a CAPTCHA page that the wrapper silently parsed as zero results.
Source
Thrown at clis/google/search.js:134
var paaContainers = document.querySelectorAll('[data-sgrd="true"]');
for (var i = 0; i < paaContainers.length; i++) {
var questionEl = paaContainers[i].querySelector('span.CSkcDe');
if (questionEl) {
results.push({
type: 'paa',
title: questionEl.textContent.trim(),
url: '',
snippet: '',
});
}
}
return {items: results};
})()
`);
const results = (wrapper && wrapper.items) || [];
if (results.length === 0) {
throw new CliError('NOT_FOUND', 'No search results found', 'Try a different keyword or check for CAPTCHA');
}
return results;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Re-run with a different or broader keyword to rule out a genuinely empty result set
- Check for a CAPTCHA/consent page before treating empty extraction as NOT_FOUND (like the images command does)
- Add a wait for result containers before running the wrapper so the page finishes rendering
- Update the wrapper's selectors if Google changed the SERP markup
Example fix
// before
const results = (wrapper && wrapper.items) || [];
if (results.length === 0) throw new CliError('NOT_FOUND', 'No search results found', '...');
// after
const state = await evaluatePageState(page);
if (state.captchaOrConsent) throw new CliError('BLOCKED', 'Google CAPTCHA detected', 'Solve CAPTCHA or change IP');
const results = (wrapper && wrapper.items) || []; Defensive patterns
Strategy: try-catch
Validate before calling
// validate keyword before invoking
if (!keyword || typeof keyword !== 'string') throw new Error('keyword required'); Type guard
function isBlockedByCaptcha(pageHtml) {
return typeof pageHtml === 'string' && /captcha|unusual traffic|consent/i.test(pageHtml);
} Try / catch
try {
const results = await searchCommand.func(args);
} catch (e) {
if (e.code === 'NOT_FOUND') {
console.warn('Empty SERP — check for CAPTCHA or try another keyword');
return [];
}
throw e;
} Prevention
- Rotate IPs / use residential proxies to avoid Google bot pages
- Check page state for CAPTCHA before treating empty as no-results
- Wait for SERP render before evaluating the wrapper
- Broaden the keyword when a niche query returns nothing
When it happens
Trigger: The browser-evaluate wrapper returns undefined or wrapper.items is an empty array after scraping a Google SERP — due to a query with no results, an unrendered page, or a CAPTCHA/consent page replacing the SERP.
Common situations: Bot detection serving a 'sorry' page so selectors find nothing; page.evaluate running before search results render; extremely rare keyword returning zero organic results; Google layout change breaking the wrapper's selectors.
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/35db4cff9b5209f8.
Report an issue: GitHub.