{"record":{"id":"69a7ce30d64bc715","repo":"BerriAI/litellm","slug":"no-db-connected-see-https-docs-litellm-ai-doc","errorCode":null,"errorMessage":"No DB Connected. See - https://docs.litellm.ai/docs/proxy/virtual_keys","messagePattern":"No DB Connected\\. See - https://docs\\.litellm\\.ai/docs/proxy/virtual_keys","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"litellm/proxy/auth/auth_checks.py","lineNumber":2543,"sourceCode":"    team_id: str,\n    prisma_client: PrismaClient | None,\n    user_api_key_cache: UserApiKeyCache,\n    parent_otel_span: Span | None = None,\n    proxy_logging_obj: ProxyLogging | None = None,\n    check_cache_only: bool | None = None,\n    check_db_only: bool | None = None,\n    team_id_upsert: bool | None = None,\n) -> LiteLLM_TeamTableCachedObj:\n    \"\"\"\n    - Check if team id in proxy Team Table\n    - if valid, return LiteLLM_TeamTable object with defined limits\n    - if not, then raise an error\n\n    Raises:\n        - HTTPException: If team doesn't exist in db or cache (status_code=404)\n    \"\"\"\n    if prisma_client is None:\n        raise Exception(\"No DB Connected. See - https://docs.litellm.ai/docs/proxy/virtual_keys\")\n\n    # check if in cache\n    key: Final = f\"team_id:{team_id}\"\n\n    if not check_db_only:\n        cached_team_obj: Final = await _get_team_object_from_cache(\n            key=key,\n            proxy_logging_obj=proxy_logging_obj,\n            user_api_key_cache=user_api_key_cache,\n            parent_otel_span=parent_otel_span,\n        )\n\n        if cached_team_obj is not None:\n            return cached_team_obj\n\n        if check_cache_only:\n            raise HTTPException(\n                status_code=404,","sourceCodeStart":2525,"sourceCodeEnd":2561,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/auth/auth_checks.py#L2525-L2561","documentation":"Raised by get_team_object when a team row must be resolved but prisma_client is None. Team-scoped keys, team budgets and team model access all read LiteLLM_TeamTable, so any team_id on a key makes the database mandatory.","triggerScenarios":"A key with a team_id authenticates while the proxy runs without DATABASE_URL; even cache-first paths raise here because the DB fallback is structurally unavailable.","commonSituations":"Teams/virtual-key features enabled on a deployment that never configured a database; DATABASE_URL dropped during a migration to a new orchestrator.","solutions":["Set DATABASE_URL and restart so prisma_client is initialized","Run prisma migrations to create the team tables","If running DB-less intentionally, remove team_id from keys"],"exampleFix":"# before\nlitellm --config config.yaml  # teams configured, no DB\n\n# after\nDATABASE_URL=\"postgresql://user:pass@host:5432/litellm\" litellm --config config.yaml","handlingStrategy":"validation","validationCode":"# operator preflight: team-scoped keys require the DB\nimport os\n\nif any(k.get(\"team_id\") for k in keys) and not os.getenv(\"DATABASE_URL\"):\n    raise SystemExit(\"team-scoped keys require DATABASE_URL\")","typeGuard":null,"tryCatchPattern":"try:\n    resp = client.chat.completions.create(**payload)\nexcept Exception as e:\n    if \"No DB Connected\" in str(e):\n        raise RuntimeError(\"proxy misconfigured: DATABASE_URL missing\") from e\n    raise","preventionTips":["Any key with team_id implies a database is required - configure it at deploy time","Include DATABASE_URL in infrastructure templates and helm values by default","Validate prisma connectivity in a post-deploy health check"],"tags":["database","prisma","team","config","litellm-proxy"],"backgroundTag":"database-not-connected","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}