can1357/oh-my-pi · error · Error
No Gemini credentials found. Set GEMINI_API_KEY, configure a
Error message
No Gemini credentials found. Set GEMINI_API_KEY, configure an API key for provider "google", or login with 'omp /login google-gemini-cli' / 'omp /login google-antigravity' to enable Gemini web search.
What it means
Thrown by searchGemini when no usable Gemini credential can be resolved: no OAuth seed (google-gemini-cli / google-antigravity login) is present and the stored API key for the resolved developer endpoint (provider 'google', GEMINI_API_KEY, or a Cloudflare AI Gateway credential) is missing or unparseable. It is a plain Error, not a SearchProviderError, because it is a local configuration problem, not a remote API failure.
Source
Thrown at packages/coding-agent/src/web/search/providers/gemini.ts:667
url_context: params.url_context,
},
params.fetch,
params.signal,
params.timeoutMs,
params.antigravityEndpointMode,
),
{ sessionId: params.sessionId, signal: params.signal, seed: seed.access },
);
} else {
const endpoint = resolveGeminiDeveloperEndpoint();
const storedApiKey = await params.authStorage.getApiKey(endpoint.authProvider, params.sessionId, {
signal: params.signal,
});
const apiKey = endpoint.isCloudflareGateway
? parseCloudflareAiGatewayCredential(storedApiKey ?? "")?.token
: storedApiKey;
if (!apiKey) {
throw new Error(
endpoint.isCloudflareGateway
? 'No Cloudflare AI Gateway credential found. Configure provider "cloudflare-ai-gateway" or set CLOUDFLARE_AI_GATEWAY_API_KEY.'
: "No Gemini credentials found. Set GEMINI_API_KEY, configure an API key for provider \"google\", or login with 'omp /login google-gemini-cli' / 'omp /login google-antigravity' to enable Gemini web search.",
);
}
result = await callGeminiDeveloperSearch(
apiKey,
endpoint,
selectedModel,
searchQuery,
params.system_prompt,
params.max_output_tokens,
params.temperature,
{
google_search: params.google_search,
code_execution: params.code_execution,
url_context: params.url_context,
},View on GitHub (pinned to 9690622007)
Solutions
- Run `omp /login google-gemini-cli` (or google-antigravity) to set up OAuth credentials.
- Export GEMINI_API_KEY with a valid AI Studio key, or configure an API key for provider "google" in AuthStorage.
- If intending to use Cloudflare AI Gateway, configure provider "cloudflare-ai-gateway" (CLOUDFLARE_AI_GATEWAY_API_KEY) with the expected credential format.
- Check the resolved endpoint config to confirm which auth provider it expects before setting keys.
Example fix
# before $ omp web-search --provider gemini "query" # Error: No Gemini credentials found # after $ export GEMINI_API_KEY=AIza... $ omp web-search --provider gemini "query"
Defensive patterns
Strategy: validation
Validate before calling
import { AuthStorage } from './auth';
async function assertGeminiReady(auth: AuthStorage, sessionId?: string): Promise<void> {
if (!process.env.GEMINI_API_KEY && !(await auth.getApiKey('google', sessionId))) {
throw new Error('Gemini search unavailable: run `omp /login google-gemini-cli` or set GEMINI_API_KEY');
}
} Try / catch
try {
return await searchGemini(params);
} catch (err) {
if (err instanceof Error && err.message.includes('No Gemini credentials found')) {
return fallbackProviderSearch(params); // e.g. use google or jina instead
}
throw err;
} Prevention
- Set GEMINI_API_KEY in the environment (or .env) before invoking Gemini search.
- Prefer explicit `omp /login google-gemini-cli` OAuth setup on shared machines.
- In CI, provision the key as a secret rather than relying on local login state.
- When using Cloudflare AI Gateway, store the credential under the cloudflare-ai-gateway provider in the expected format.
When it happens
Trigger: Calling the Gemini web search provider (via search()/response) when: GEMINI_API_KEY is unset; provider 'google' has no API key in AuthStorage; the endpoint resolved to Cloudflare AI Gateway but the stored credential is not a parseable Cloudflare AI Gateway credential (parseCloudflareAiGatewayCredential returned undefined).
Common situations: Fresh install with no omp /login; CI environment without GEMINI_API_KEY exported; user logged into Google via a different tool; setting the Cloudflare gateway key in the wrong provider slot or in the wrong format.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- Azure OpenAI API key is required. Set AZURE_OPENAI_API_KEY e
- CoreWeave Serverless Inference requires OpenAI-Project. Set
- An OpenAI API credential is required for file uploads
- No API key for ${model.provider}/${model.id}
- No API key available for model ${model.provider}/${model.id}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/e19d8da25f322143.
Report an issue: GitHub.