BerriAI/litellm · error · HTTPException

Member not found in organization for user_id={data.user_id}

Error message

Member not found in organization for user_id={data.user_id}

What it means

The membership query succeeded but returned None: the user exists but has no membership row in this organization. This fires on member update/delete flows when the caller targets a user who was never added to (or was already removed from) the given organization; raised as 404.

Source

Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1363

            existing_organization_membership: Final = await _table(
                OrganizationMembershipRepository(prisma_client)
            ).find_unique(
                where={
                    "user_id_organization_id": {
                        "user_id": data.user_id,
                        "organization_id": data.organization_id,
                    }
                }
            )
        except Exception as e:
            raise HTTPException(
                status_code=400,
                detail={
                    "error": f"Error finding organization membership for user_id={data.user_id} in organization={data.organization_id}: {e}"
                },
            )
        if existing_organization_membership is None:
            raise HTTPException(
                status_code=404,
                detail={"error": f"Member not found in organization for user_id={data.user_id}"},
            )

        # Reject attempts to change the role of a global PROXY_ADMIN via
        # org-scoped operations. An org-admin of any org could otherwise
        # alter a PROXY_ADMIN user's per-org role, which has downstream
        # effects on admin UI filtering and scope derivation.
        target_user_row = await _table(UserRepository(prisma_client)).find_unique(where={"user_id": data.user_id})
        if target_user_row is not None and getattr(target_user_row, "user_role", None) in (
            LitellmUserRoles.PROXY_ADMIN.value,
            LitellmUserRoles.PROXY_ADMIN_VIEW_ONLY.value,
        ):
            if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN.value:
                raise HTTPException(
                    status_code=403,
                    detail={
                        "error": (

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the user_id is a member of the organization before updating.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1363 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/ca6bce4354529ef4. Report an issue: GitHub.