BerriAI/litellm · error · HTTPException

f"User not found, passed user_id={user_id}"

Error message

f"User not found, passed user_id={user_id}"

What it means

Error "f"User not found, passed user_id={user_id}"" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:2279

    # Batch-fetch target memberships once before the per-user loop. Avoids
    # an N+1 DB call when delete_user is called with a large user_ids list.
    target_org_ids_by_user: Final[dict[str, set]] = {}
    if not caller_is_proxy_admin:
        all_target_memberships: Final = await _organization_membership_table(prisma_client).find_many(
            where={"user_id": {"in": data.user_ids}}
        )
        for m in all_target_memberships:
            if not m.organization_id:
                continue
            target_org_ids_by_user.setdefault(m.user_id, set()).add(m.organization_id)

    # check that all teams passed exist
    for user_id in data.user_ids:
        user_row = await UserRepository(prisma_client).table.find_unique(where={"user_id": user_id})

        if user_row is None:
            raise HTTPException(
                status_code=404,
                detail={"error": f"User not found, passed user_id={user_id}"},
            )

        if not caller_is_proxy_admin:
            target_org_ids = target_org_ids_by_user.get(user_id, set())
            # Org-admin may only delete users whose entire org membership is
            # within their admin scope. A target with ANY org outside the
            # caller's scope (or no org at all) requires PROXY_ADMIN.
            if not target_org_ids or not target_org_ids.issubset(caller_admin_org_ids):
                raise HTTPException(
                    status_code=403,
                    detail={
                        "error": (
                            f"User {user_id} is not within your admin scope. "
                            "Only PROXY_ADMIN may delete users outside your "
                            "administered organizations."
                        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the user_id exists via /user/list or /user/info before deleting.
  2. Check for typos in the user_id value passed in the request.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/internal_user_endpoints.py:2279 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/e6e9aa626d859596. Report an issue: GitHub.