BerriAI/litellm · error · HTTPException

Database not connected. Connect a database to your proxy

Error message

Database not connected. Connect a database to your proxy

What it means

Sentinel guard thrown by get_prisma_client_or_throw: an MCP management endpoint that must persist to the LiteLLM database was called while no Prisma client exists, i.e. the proxy is running without DATABASE_URL configured. The input at fault is the deployment configuration (missing DB), not the request body.

Source

Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:851

            static_headers=payload.static_headers,
            command=payload.command,
            args=payload.args,
            env=payload.env,
            issuer=payload.issuer,
            authorization_url=payload.authorization_url,
            token_url=payload.token_url,
            registration_url=payload.registration_url,
            allow_all_keys=payload.allow_all_keys,
            available_on_public_internet=payload.available_on_public_internet,
            timeout=payload.timeout,
            max_concurrent_requests=payload.max_concurrent_requests,
        )

    def get_prisma_client_or_throw(message: str):
        from litellm.proxy.proxy_server import prisma_client

        if prisma_client is None:
            raise HTTPException(
                status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
                detail={"error": message},
            )
        return prisma_client

    # Router to fetch all MCP tools available for the current key

    @router.get(
        "/tools",
        tags=["mcp"],
        dependencies=[Depends(user_api_key_auth)],
    )
    async def get_mcp_tools(
        user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
    ):
        """
        Get all MCP tools available for the current key, including those from access groups
        """

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set DATABASE_URL to a valid PostgreSQL connection string and restart the proxy.
  2. Check proxy startup logs for database connection errors.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/mcp_management_endpoints.py:851 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/b737e6218a199557. Report an issue: GitHub.