BerriAI/litellm · error · HTTPException

User user_id={caller_user_id} is not a member of team_id={te

Error message

User user_id={caller_user_id} is not a member of team_id={team_id}.

What it means

Error "User user_id={caller_user_id} is not a member of team_id={team_id}." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4303

        user_api_key_cache=user_api_key_cache,
    )

    caller_user_email: Final = user_api_key_dict.user_email
    member_role: str | None = None
    for m in team_table.members_with_roles:
        # Match by user_id when present, else fall back to email — members
        # added by email may have user_id=None on the stored entry.
        if (m.user_id is not None and m.user_id == caller_user_id) or (
            m.user_email is not None and caller_user_email is not None and m.user_email == caller_user_email
        ):
            member_role = m.role
            break

    if member_role is None:
        # Caller is not a member of this team. Even proxy admins get 404 here —
        # they can use /team/info to view all members; "me" only resolves for
        # actual members of the team.
        raise HTTPException(
            status_code=status.HTTP_404_NOT_FOUND,
            detail={"error": f"User user_id={caller_user_id} is not a member of team_id={team_id}."},
        )

    membership: Final = await get_team_membership(
        user_id=caller_user_id,
        team_id=team_id,
        prisma_client=prisma_client,
        user_api_key_cache=user_api_key_cache,
    )

    user_row: Final = await get_user_object(
        user_id=caller_user_id,
        prisma_client=prisma_client,
        user_api_key_cache=user_api_key_cache,
        user_id_upsert=False,
    )
    user_email: Final = getattr(user_row, "user_email", None) if user_row is not None else None

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Add the user to the team first, or call with a key for a user who is a member of the team.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/team_endpoints.py:4303 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/0aa7b5c1510e92c4. Report an issue: GitHub.