mvanhorn/last30days-skill · critical · RuntimeError
Gemini selected but no Google API key is configured.
Error message
Gemini selected but no Google API key is configured.
What it means
RuntimeError raised in resolve_runtime when the reasoning provider is explicitly 'gemini' but no Google API key was found in the config/environment. Gemini is not optional once selected - unlike the no-key local fallback path - so the resolution aborts rather than silently degrading.
Source
Thrown at skills/last30days/scripts/lib/providers.py:266
elif openai_token and config.get("OPENAI_AUTH_STATUS") == env.AUTH_STATUS_OK:
provider_name = "openai"
elif xai_key:
provider_name = "xai"
elif config.get("OPENROUTER_API_KEY"):
provider_name = "openrouter"
else:
return schema.ProviderRuntime(
reasoning_provider="local",
planner_model="deterministic",
rerank_model="local-score",
x_search_backend=_resolve_x_backend(config),
), None
planner_model, rerank_model = _resolve_model_pins(config, depth, provider_name)
if provider_name == "gemini":
if not google_key:
raise RuntimeError("Gemini selected but no Google API key is configured.")
runtime = schema.ProviderRuntime(
reasoning_provider="gemini",
planner_model=planner_model,
rerank_model=rerank_model,
x_search_backend=_resolve_x_backend(config),
)
return runtime, GeminiClient(google_key)
if provider_name == "openai":
if not openai_token or config.get("OPENAI_AUTH_STATUS") != env.AUTH_STATUS_OK:
raise RuntimeError("OpenAI selected but no valid OpenAI auth is configured.")
runtime = schema.ProviderRuntime(
reasoning_provider="openai",
planner_model=planner_model,
rerank_model=rerank_model,
x_search_backend=_resolve_x_backend(config),View on GitHub (pinned to c7460f6114)
Solutions
- Set GOOGLE_API_KEY (or the env var the env module reads) in ~/.config/last30days/.env or the shell
- Re-run the first-run setup flow which persists the key
- If you intended credential-free runs, switch the provider to the local/deterministic path instead of gemini
Example fix
# before LAST30DAYS_REASONING_PROVIDER=gemini # (no key anywhere) # after LAST30DAYS_REASONING_PROVIDER=gemini GOOGLE_API_KEY=your-key-here
Defensive patterns
Strategy: validation
Validate before calling
if (os.environ.get("LAST30DAYS_REASONING_PROVIDER") or "gemini").lower() == "gemini":
if not os.environ.get("GOOGLE_API_KEY"):
raise SystemExit("Set GOOGLE_API_KEY before selecting the gemini provider") Type guard
def gemini_ready(config: dict) -> bool:
provider = (config.get("LAST30DAYS_REASONING_PROVIDER") or "gemini").lower()
return provider != "gemini" or bool(os.environ.get("GOOGLE_API_KEY")) Try / catch
try:
runtime, client = resolve_runtime(config, depth)
except RuntimeError as e:
if "no Google API key" in str(e):
prompt_user_for_key() # or fall back to local runtime deliberately Prevention
- Run the first-run setup so the Google key is persisted in the .env layer
- Preflight-check credentials before launching a long research run
- If no key is intended, choose the local/deterministic provider explicitly
When it happens
Trigger: LAST30DAYS_REASONING_PROVIDER=gemini (or auto-resolved to gemini) with GOOGLE_API_KEY / GEMINI_API_KEY unset, empty, or not loaded from ~/.config/last30days/.env.
Common situations: Fresh install without onboarding completed; key stored in a different shell's env and not visible to the agent subprocess; .env file at wrong path; key deleted or never created after skipping the setup wizard.
Related errors
- xAI selected but XAI_API_KEY is not configured.
- OpenRouter selected but OPENROUTER_API_KEY is not configured
- No sources are available for this run.
- No X backend is available.
- Unsupported reasoning provider: {provider_name}
AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15).
Data as JSON: /api/errors/ecae940cbdab4276.
Report an issue: GitHub.