{"record":{"id":"e19d8da25f322143","repo":"can1357/oh-my-pi","slug":"no-gemini-credentials-found-set-gemini-api-key-c","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/web/search/providers/gemini.ts","lineNumber":667,"sourceCode":"\t\t\t\t\t\turl_context: params.url_context,\n\t\t\t\t\t},\n\t\t\t\t\tparams.fetch,\n\t\t\t\t\tparams.signal,\n\t\t\t\t\tparams.timeoutMs,\n\t\t\t\t\tparams.antigravityEndpointMode,\n\t\t\t\t),\n\t\t\t{ sessionId: params.sessionId, signal: params.signal, seed: seed.access },\n\t\t);\n\t} else {\n\t\tconst endpoint = resolveGeminiDeveloperEndpoint();\n\t\tconst storedApiKey = await params.authStorage.getApiKey(endpoint.authProvider, params.sessionId, {\n\t\t\tsignal: params.signal,\n\t\t});\n\t\tconst apiKey = endpoint.isCloudflareGateway\n\t\t\t? parseCloudflareAiGatewayCredential(storedApiKey ?? \"\")?.token\n\t\t\t: storedApiKey;\n\t\tif (!apiKey) {\n\t\t\tthrow new Error(\n\t\t\t\tendpoint.isCloudflareGateway\n\t\t\t\t\t? 'No Cloudflare AI Gateway credential found. Configure provider \"cloudflare-ai-gateway\" or set CLOUDFLARE_AI_GATEWAY_API_KEY.'\n\t\t\t\t\t: \"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.\",\n\t\t\t);\n\t\t}\n\t\tresult = await callGeminiDeveloperSearch(\n\t\t\tapiKey,\n\t\t\tendpoint,\n\t\t\tselectedModel,\n\t\t\tsearchQuery,\n\t\t\tparams.system_prompt,\n\t\t\tparams.max_output_tokens,\n\t\t\tparams.temperature,\n\t\t\t{\n\t\t\t\tgoogle_search: params.google_search,\n\t\t\t\tcode_execution: params.code_execution,\n\t\t\t\turl_context: params.url_context,\n\t\t\t},","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/web/search/providers/gemini.ts#L649-L685","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"# before\n$ omp web-search --provider gemini \"query\"  # Error: No Gemini credentials found\n# after\n$ export GEMINI_API_KEY=AIza...\n$ omp web-search --provider gemini \"query\"","handlingStrategy":"validation","validationCode":"import { AuthStorage } from './auth';\nasync function assertGeminiReady(auth: AuthStorage, sessionId?: string): Promise<void> {\n  if (!process.env.GEMINI_API_KEY && !(await auth.getApiKey('google', sessionId))) {\n    throw new Error('Gemini search unavailable: run `omp /login google-gemini-cli` or set GEMINI_API_KEY');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await searchGemini(params);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('No Gemini credentials found')) {\n    return fallbackProviderSearch(params); // e.g. use google or jina instead\n  }\n  throw err;\n}","preventionTips":["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."],"tags":["configuration","api-key","missing-env-var","gemini","authentication"],"backgroundTag":"missing-api-key","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}