can1357/oh-my-pi · error · SearchProviderError
Google browser search failed: ${message}
Error message
Google browser search failed: ${message} What it means
Thrown by callGoogleHtml when the browser fetch of Google Search fails with an unexpected error that is neither a SearchProviderError nor a caller abort and the timeout signal has not fired. The original error message is embedded and wrapped as status 503 (upstream failure).
Source
Thrown at packages/coding-agent/src/web/search/providers/google.ts:141
try {
page = await browserFetch(url, {
fetch: params.fetch,
signal,
timeoutMs: params.timeoutMs,
referer: GOOGLE_HOME_URL,
browser: {
homeUrl: GOOGLE_HOME_URL,
ready: { selector: "a h3", timeoutMs: RESULT_RENDER_TIMEOUT_MS },
shouldFallback: candidate => blockReason(candidate) !== undefined,
},
});
} catch (error) {
if (error instanceof SearchProviderError || params.signal?.aborted) throw error;
if (signal.aborted) {
throw new SearchProviderError("google", "Google browser search timed out.", 504);
}
const message = error instanceof Error ? error.message : String(error);
throw new SearchProviderError("google", `Google browser search failed: ${message}`, 503);
}
const blocked = blockReason(page);
if (blocked === "traffic") {
throw new SearchProviderError(
"google",
"Google blocked the browser search with an automated-traffic challenge. Try another web search provider or retry later.",
429,
);
}
if (page.status < 200 || page.status >= 300) {
throw new SearchProviderError("google", `Google HTML error (${page.status})`, page.status);
}
if (blocked === "javascript") {
throw new SearchProviderError(
"google",
"Google returned its JavaScript challenge instead of rendered search results.",
429,View on GitHub (pinned to 9690622007)
Solutions
- Inspect the embedded `message` for the root cause (DNS, proxy, browser launch, TLS).
- Install/verify the headless browser runtime used by browserFetch if the fetch-first path fell back.
- Fix network/proxy settings so google.com is reachable from the host.
- Configure a different search provider if scraping Google is blocked in your network environment.
Example fix
# before: container without browser deps $ omp web-search --provider google "q" # Google browser search failed: Failed to launch browser # after $ npx playwright install --with-deps chromium
Defensive patterns
Strategy: fallback
Validate before calling
// check egress and browser availability before scraping
dns.lookup('www.google.com', err => { if (err) console.error('google.com unreachable'); }); Type guard
function isGoogleTransportFailure(e: unknown): boolean {
return e instanceof SearchProviderError && e.provider === 'google' && e.statusCode === 503;
} Try / catch
try {
return await search({ provider: 'google', query });
} catch (err) {
if (isGoogleTransportFailure(err)) return await search({ provider: 'jina', query });
throw err;
} Prevention
- Install the headless browser runtime and its OS dependencies in containers.
- Allow google.com egress through firewalls/proxies.
- Handle corporate TLS inspection certs in the runtime trust store.
- Always configure a secondary API-backed search provider.
When it happens
Trigger: browserFetch throws during the fetch-first attempt or headless-browser fallback — e.g. browser launch failure, DNS/network errors, TLS errors, or a page-load crash — while neither params.signal nor the hard-timeout signal is aborted.
Common situations: Headless browser (Playwright/Chromium) not installed or failing to launch in CI/containers; corporate proxy blocking google.com; DNS failure; SSL inspection certificates breaking the fetch.
Related errors
- Google browser search timed out.
- Google API stream ended without a finish reason (connection
- Google API returned an empty response body
- Timed out waiting for CDP endpoint ${cdpUrl}${lastStatus !==
- tab.waitForResponse() timed out after ${timeoutMs}ms
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/1ab9ff7c5e72b213.
Report an issue: GitHub.