{"record":{"id":"7c9eb22ea6dd7c41","repo":"BerriAI/litellm","slug":"server-misconfigured-no-database-connection","errorCode":null,"errorMessage":"Server misconfigured: no database connection","messagePattern":"Server misconfigured: no database connection","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py","lineNumber":918,"sourceCode":"    @staticmethod\n    async def _reload_admitted_user(user_id: str) -> UserAPIKeyAuth:\n        \"\"\"Reload the live user an interactively-minted envelope references and admit them as themselves.\n\n        The user's own object permission and ``org_id`` ride on the returned ``UserAPIKeyAuth``, and the\n        SAME ``get_allowed_mcp_servers`` the key path uses gates the request. The ``mcp_admitted_user_subject``\n        marker (set below) makes that resolver union the servers the user reaches through ANY of their teams\n        on top of these direct grants, each source bounded by ITS OWN org, so a user spanning organizations\n        cannot leak one org's servers past another's ceiling.\n\n        Error handling: ``get_user_object`` catches every DB failure and re-raises a bare ``ValueError``, so a\n        missing user and a real outage look identical (the cause survives only as ``__context__``).\n        ``_raise_503_if_db_unavailable`` walks the cause chain so an outage stays a retryable 503 while any\n        other failure fails closed as 401, not an opaque 500; the object-permission load shares that boundary.\"\"\"\n        from litellm.proxy.auth.auth_checks import get_object_permission, get_user_object\n        from litellm.proxy.proxy_server import prisma_client, user_api_key_cache\n\n        if prisma_client is None:\n            raise HTTPException(status_code=500, detail=\"Server misconfigured: no database connection\")\n        try:\n            user_object: Final = await get_user_object(\n                user_id=user_id,\n                prisma_client=prisma_client,\n                user_api_key_cache=user_api_key_cache,\n                user_id_upsert=False,\n            )\n            # Resolve the user's own MCP object permission (get_user_object does not load it) so the shared\n            # get_allowed_mcp_servers can grant the user their litellm-granted servers. Reuses the same\n            # get_object_permission resolver the key and team paths use; no permission logic is duplicated.\n            object_permission = user_object.object_permission if user_object is not None else None\n            if user_object is not None and object_permission is None and user_object.object_permission_id:\n                object_permission = await get_object_permission(\n                    object_permission_id=user_object.object_permission_id,\n                    prisma_client=prisma_client,\n                    user_api_key_cache=user_api_key_cache,\n                )\n        except (ProxyException, HTTPException):","sourceCodeStart":900,"sourceCodeEnd":936,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py#L900-L936","documentation":"HTTP 500 in the MCP user-reload path: the handler needed the proxy database (Prisma client) but it is not initialized — typically a test or misconfigured server running without a DB — so the live user cannot be re-fetched.","triggerScenarios":"Thrown at litellm/proxy/_experimental/mcp_server/auth/user_api_key_auth_mcp.py:918 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure DATABASE_URL so the proxy can verify credentials."],"exampleFix":"export DATABASE_URL='postgresql://user:pass@host/db'","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"}