mvanhorn/last30days-skill · critical · RuntimeError
OpenAI selected but no valid OpenAI auth is configured.
Error message
OpenAI selected but no valid OpenAI auth is configured.
What it means
RuntimeError raised in resolve_runtime for provider 'openai' when either the OpenAI token is missing or the OPENAI_AUTH_STATUS config entry is not the AUTH_STATUS_OK sentinel. The double gate means a merely-present token is insufficient - auth must have been validated by the env/onboarding layer.
Source
Thrown at skills/last30days/scripts/lib/providers.py:278
), 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),
)
return runtime, OpenAIClient(
openai_token
)
if provider_name == "xai":
if not xai_key:
raise RuntimeError("xAI selected but XAI_API_KEY is not configured.")
runtime = schema.ProviderRuntime(
reasoning_provider="xai",
planner_model=planner_model,
rerank_model=rerank_model,View on GitHub (pinned to c7460f6114)
Solutions
- Re-run the setup/auth flow so the OpenAI token is validated and OPENAI_AUTH_STATUS is set to OK
- Replace an expired OPENAI_API_KEY with a working one and re-validate
- Verify both the token variable and the auth-status variable are loaded into the config dict, not just the shell
Example fix
# before OPENAI_API_KEY=sk-expired... # OPENAI_AUTH_STATUS unset -> raise # after OPENAI_API_KEY=sk-valid... OPENAI_AUTH_STATUS=ok # written by validated onboarding
Defensive patterns
Strategy: validation
Validate before calling
def openai_ready(config: dict) -> bool:
return bool(
config.get("OPENAI_API_KEY")
and config.get("OPENAI_AUTH_STATUS") == "ok"
) Type guard
def openai_auth_ok(config: dict) -> bool:
# both gates from providers.py: token present AND status validated
return bool(config.get("OPENAI_API_KEY")) and config.get("OPENAI_AUTH_STATUS") is not None Try / catch
try:
runtime, client = resolve_runtime(config, depth)
except RuntimeError as e:
if "no valid OpenAI auth" in str(e):
rerun_onboarding_auth() # revalidates token and rewrites status Prevention
- Re-run auth onboarding after rotating the OpenAI key so the status entry is rewritten
- Never assume a present key equals a validated key - the status gate exists
- Preflight both OPENAI_API_KEY and OPENAI_AUTH_STATUS in CI job setup
When it happens
Trigger: LAST30DAYS_REASONING_PROVIDER=openai with OPENAI_API_KEY absent, or with the key present but OPENAI_AUTH_STATUS not marked OK (e.g. token failed validation during onboarding, or status was never written).
Common situations: Expired or revoked OpenAI tokens where auth validation failed but the raw key lingers in env; partial onboarding that saved the key but not the status entry; env files copied between machines with mismatched status keys.
Related errors
- Gemini selected but no Google API key is configured.
- 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.
AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15).
Data as JSON: /api/errors/ce82de486eeba3a5.
Report an issue: GitHub.