BerriAI/litellm · error · HTTPException

Duplicate default team id(s): {', '.join(duplicate_ids)}. Li

Error message

Duplicate default team id(s): {', '.join(duplicate_ids)}. List each default team only once.

What it means

Validation in _validate_default_teams_exist: the same team_id appears more than once in the default-teams list. Because team assignment iterates the list, duplicates would double-assign or corrupt bookkeeping, so they are rejected at save time with the offending ids named.

Source

Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:701

def _default_team_ids(teams: list[str] | list[NewUserRequestTeam]) -> tuple[str, ...]:
    return tuple(team if isinstance(team, str) else team.team_id for team in teams)


async def _validate_default_teams_exist(teams: list[str] | list[NewUserRequestTeam]) -> None:
    """Reject default teams that cannot be assigned.

    New users are added to these teams long after the settings are saved, and that
    consume path swallows the resulting 404, so an unknown team id would silently
    drop every future user's team assignment unless it is caught here.
    """
    team_ids: Final = _default_team_ids(teams)
    if not team_ids:
        return

    duplicate_ids: Final = tuple(team_id for team_id, count in Counter(team_ids).items() if count > 1)
    if duplicate_ids:
        raise HTTPException(
            status_code=400,
            detail={
                "error": f"Duplicate default team id(s): {', '.join(duplicate_ids)}. List each default team only once."
            },
        )

    from litellm.proxy.proxy_server import prisma_client

    if prisma_client is None:
        raise HTTPException(
            status_code=500,
            detail={"error": "Database not connected. Please connect a database."},
        )

    existing_teams: Final = await TeamRepository(prisma_client).find_many(where={"team_id": {"in": list(team_ids)}})
    existing_team_ids: Final = {team.team_id for team in existing_teams}
    missing_ids: Final = tuple(team_id for team_id in team_ids if team_id not in existing_team_ids)
    if missing_ids:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Remove duplicate team ids from the default teams list so each team appears only once.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:701 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/dfb7840d1d2347e5. Report an issue: GitHub.