{"record":{"id":"0aacd761b545c106","repo":"BerriAI/litellm","slug":"no-db-connected-see-https-docs-litellm-ai-doc-0aacd7","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":"NoDatabaseConnectionError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/auth/resolvers/store.py","lineNumber":104,"sourceCode":"            subject_fallback=key.token,\n            credential_ref=CredentialRef(token_id=key.token),\n        )\n\n    @staticmethod\n    def key_from_principal(principal: Principal) -> UserAPIKeyAuth:\n        \"\"\"Hand back the resolved key object carried on the Principal.\n\n        Stopgap for the request flow that still consumes ``UserAPIKeyAuth`` for\n        budget, rate-limit, and policy state. Only Principals produced by\n        ``resolve`` carry a source key.\n        \"\"\"\n        if principal.source_key is None:\n            raise PrincipalMissingSourceKeyError()\n        return principal.source_key\n\n    async def _resolve_key(self, hashed_token: str) -> UserAPIKeyAuth:\n        if self._prisma is None:\n            raise NoDatabaseConnectionError()\n\n        cached: Final = await self._cache.async_get_cache(key=hashed_token, model_type=UserAPIKeyAuth)\n        if cached is not None:\n            return _copy_user_api_key_auth_for_cache(user_api_key_obj=cached)\n\n        if self._check_cache_only:\n            raise KeyNotInCacheError(hashed_token)\n\n        from_db: Final[BaseModel | None] = await _fetch_key_object_from_db_with_reconnect(\n            hashed_token=hashed_token,\n            prisma_client=self._prisma,\n            parent_otel_span=self._parent_otel_span,\n            proxy_logging_obj=self._proxy_logging_obj,\n        )\n        if from_db is None:\n            raise KeyNotFoundError(hashed_token)\n\n        key: Final = UserAPIKeyAuth.model_validate(from_db.model_dump(exclude_none=True))","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/auth/resolvers/store.py#L86-L122","documentation":"Raised by the key-store resolver when a request must be authenticated from the database but the Prisma client is not initialized (proxy running without a database). Virtual-key resolution requires the LiteLLM DB; the message points at the virtual-keys docs. It is the auth-path equivalent of the endpoints' 'Prisma client not initialized' 500.","triggerScenarios":"Thrown at litellm/proxy/auth/resolvers/store.py:104 when the library encounters an invalid state.","commonSituations":"A key lookup was attempted but no database is connected to the proxy.","solutions":["Set DATABASE_URL to a PostgreSQL connection string so the proxy can store virtual keys.","See https://docs.litellm.ai/docs/proxy/virtual_keys for database setup."],"exampleFix":"export DATABASE_URL=postgresql://user:pass@host:5432/litellm","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}