BerriAI/litellm · error · HTTPException

User does not belong to team

Error message

User does not belong to team: {team_id}. Available teams: {user_teams}

What it means

Error "User does not belong to team: {team_id}. Available teams: {user_teams}" thrown in BerriAI/litellm.

Solutions

  1. Pick one of the available teams listed in the error, or ask an admin to add the user to the team.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/ui_sso.py:2478 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/c0dc4ae3224bf9e7. Report an issue: GitHub.

Appendix: source

Thrown at litellm/proxy/management_endpoints/ui_sso.py:2478

                    team_details_response = user_team_details
                elif user_teams:
                    team_details_response = [{"team_id": t, "team_alias": None} for t in user_teams]
                poll_response: dict[str, object] = {
                    "status": "ready",
                    "user_id": user_id,
                    "teams": user_teams,
                    "team_details": team_details_response,
                    "requires_team_selection": True,
                }
                attribution_metadata = _cli_poll_attribution_metadata_from_session(session_data)
                if attribution_metadata:
                    poll_response["attribution_metadata"] = attribution_metadata
                return poll_response

            # Validate team_id if provided
            if team_id is not None:
                if team_id not in user_teams:
                    raise HTTPException(
                        status_code=403,
                        detail=f"User does not belong to team: {team_id}. Available teams: {user_teams}",
                    )
            else:
                # If no team_id provided and user has 0 or 1 team, use first team (or None)
                team_id = user_teams[0] if len(user_teams) > 0 else None

            selected_team: Final = _selected_cli_sso_team_detail(
                team_details=user_team_details,
                team_id=team_id,
            )
            if selected_team is None:
                raise HTTPException(
                    status_code=500,
                    detail=f"Could not resolve the model grants for team: {team_id}. Please run `lite login` again",
                )

            user_info: Final = LiteLLM_UserTable(

View on GitHub (pinned to 77b7c6c40c)