BerriAI/litellm · error · HTTPException

User not found with ID: {user_id}

Error message

User not found with ID: {user_id}

What it means

_check_user_exists performs find_unique on LiteLLM_UserTable by user_id and gets None: the SCIM caller addressed a user id that does not exist. Raised as 404 so SCIM clients get the standard not-found semantics.

Source

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

# 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()

    team: Final = await _table(TeamRepository(prisma_client)).find_unique(where={"team_id": team_id})

    if not team:
        raise HTTPException(status_code=404, detail={"error": f"Group not found with ID: {team_id}"})

    return team


def _extract_scim_user_data(user: SCIMUser) -> ScimUserData:
    """Extract common data from SCIMUser object."""

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the user ID. List users via GET /Users to find valid IDs.
Defensive patterns

Strategy: validation

When it happens

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