BerriAI/litellm · error · HTTPException

No database connected

Error message

No database connected

What it means

_get_prisma_client_or_raise_exception in the SCIM router: the sentinel check that converts a missing global prisma_client into HTTPException 500 'No database connected'. SCIM reads/writes user and team tables, so without a DB no operation can proceed; the at-fault condition is proxy configuration.

Source

Thrown at litellm/proxy/management_endpoints/scim/scim_v2.py:258

    existing_member_ids: list[str]
    created_users: list[NewUserResponse]
    all_member_ids: list[str]  # existing + newly created


scim_router: Final = APIRouter(
    prefix="/scim/v2",
    tags=["✨ SCIM v2 (Enterprise Only)"],
    dependencies=[Depends(_premium_user_check)],
)


# Helper functions for common operations
async def _get_prisma_client_or_raise_exception():
    """Check if database is connected and raise HTTPException if not."""
    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(status_code=500, detail={"error": "No database connected"})
    return prisma_client


async def _check_user_exists(user_id: str) -> LiteLLM_UserTable:
    """Check if user exists and return user, raise 404 if not found."""
    prisma_client: Final = await _get_prisma_client_or_raise_exception()

    user: Final = await _table(UserRepository(prisma_client)).find_unique(where={"user_id": user_id})

    if not user:
        raise HTTPException(status_code=404, detail={"error": f"User not found with ID: {user_id}"})

    return user


async def _check_team_exists(team_id: str) -> LiteLLM_TeamTable:
    """Check if team exists and return team, raise 404 if not found."""
    prisma_client: Final = await _get_prisma_client_or_raise_exception()

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set DATABASE_URL to a PostgreSQL connection string and restart the proxy.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/scim/scim_v2.py:258 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/3988ed2c3df5b225. Report an issue: GitHub.