{"record":{"id":"8aa6cc142401e71c","repo":"langchain-ai/deepagents","slug":"no-credentials-configured-please-set-one-of-anth","errorCode":null,"errorMessage":"No credentials configured. Please set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY","messagePattern":"No credentials configured\\. Please set one of: ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY","errorType":"exception","errorClass":"NoCredentialsConfiguredError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/config.py","lineNumber":5145,"sourceCode":"    # `is True` deliberately excludes `ProviderAuthState.UNKNOWN` (which maps\n    # to `as_legacy_bool() -> None`). For the three explicit-credential\n    # providers below, an UNKNOWN result means we cannot prove auth works, so\n    # we fall through rather than pick an unverifiable default. If an\n    # implicit-auth provider (e.g., Vertex ADC) is added to this fallback\n    # list, switch to checking `state` against the relevant\n    # `ProviderAuthState` members directly.\n    if get_provider_auth_status(\"openai\").as_legacy_bool() is True:\n        return \"openai:gpt-5.6-terra\"\n    if get_provider_auth_status(\"anthropic\").as_legacy_bool() is True:\n        return \"anthropic:claude-opus-5\"\n    if get_provider_auth_status(\"google_genai\").as_legacy_bool() is True:\n        return \"google_genai:gemini-3.1-pro-preview\"\n\n    msg = (\n        \"No credentials configured. Please set one of: \"\n        \"ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY\"\n    )\n    raise NoCredentialsConfiguredError(msg)\n\n\n_OPENROUTER_APP_URL = \"https://pypi.org/project/deepagents-code/\"\n\"\"\"Default `app_url` (maps to `HTTP-Referer`) for OpenRouter attribution.\n\nSee https://openrouter.ai/docs/app-attribution for details.\n\"\"\"\n\n_OPENROUTER_APP_TITLE = \"Deep Agents Code\"\n\"\"\"Default `app_title` (maps to `X-Title`) for OpenRouter attribution.\"\"\"\n\n_OPENROUTER_APP_CATEGORIES: list[str] = [\"cli-agent\"]\n\"\"\"Default `app_categories` (maps to `X-OpenRouter-Categories`) for OpenRouter.\"\"\"\n\n_cli_openrouter_profile_registered = False\n\"\"\"Process-wide guard so the app's OpenRouter profile is registered exactly once.\"\"\"\n\n","sourceCodeStart":5127,"sourceCodeEnd":5163,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/config.py#L5127-L5163","documentation":"Raised when no default model can be auto-detected because none of the explicit-credential providers (openai, anthropic, google_genai) have a verifiably present API key. The resolver picks a default from available credentials, so with zero keys there is nothing to choose. Callers may catch `NoCredentialsConfiguredError` to defer startup and prompt interactively.","triggerScenarios":"Calling the default-model resolver when `models.allowed` is not configured, no default/recent model is stored, and `get_provider_auth_status(...).as_legacy_bool()` is not True for openai, anthropic, or google_genai — i.e. ANTHROPIC_API_KEY, OPENAI_API_KEY, and GOOGLE_API_KEY are all unset/empty (config.py:5134-5145).","commonSituations":"Fresh install before running `/auth`; CI/Docker containers launched without secret env vars; keys exported only in an interactive shell profile while the app runs under systemd/cron; typo'd env var name (e.g. ANTHROPIC_API_TOKEN).","solutions":["Export one of the listed keys: ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY","Run `/auth` inside dcode to store credentials persistently","Set an explicit default model in config.toml if you rely on implicit auth (e.g. Vertex ADC) that this legacy fallback does not check"],"exampleFix":"// before\n$ dcode\nNoCredentialsConfiguredError: No credentials configured...\n\n// after\n$ export ANTHROPIC_API_KEY=sk-ant-...\n$ dcode   # auto-detects anthropic:claude-opus-5","handlingStrategy":"validation","validationCode":"import os\nmissing = [k for k in (\"ANTHROPIC_API_KEY\", \"OPENAI_API_KEY\", \"GOOGLE_API_KEY\") if not os.environ.get(k)]\nif len(missing) == 3:\n    raise SystemExit(\"Set at least one of: \" + \", \".join(missing))","typeGuard":"def has_any_default_credential() -> bool:\n    import os\n    return any(os.environ.get(k) for k in (\"ANTHROPIC_API_KEY\", \"OPENAI_API_KEY\", \"GOOGLE_API_KEY\"))","tryCatchPattern":"from deepagents_code.model_config import NoCredentialsConfiguredError\ntry:\n    model_spec = resolve_default_model_spec()\nexcept NoCredentialsConfiguredError:\n    prompt_for_credentials_interactively()  # e.g. launch /auth flow","preventionTips":["Export a provider key in your shell profile and confirm it sources in non-interactive shells","Use `/auth` to persist credentials instead of relying on env vars per session","In CI, verify secret injection with a preflight `os.environ` check"],"tags":["config","credentials","env-var","startup"],"backgroundTag":"missing-env-var","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}