{"record":{"id":"dfb7840d1d2347e5","repo":"BerriAI/litellm","slug":"duplicate-default-team-id-s-join-duplicate","errorCode":null,"errorMessage":"Duplicate default team id(s): {', '.join(duplicate_ids)}. List each default team only once.","messagePattern":"Duplicate default team id\\(s\\): (.+?)\\. List each default team only once\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py","lineNumber":701,"sourceCode":"\ndef _default_team_ids(teams: list[str] | list[NewUserRequestTeam]) -> tuple[str, ...]:\n    return tuple(team if isinstance(team, str) else team.team_id for team in teams)\n\n\nasync def _validate_default_teams_exist(teams: list[str] | list[NewUserRequestTeam]) -> None:\n    \"\"\"Reject default teams that cannot be assigned.\n\n    New users are added to these teams long after the settings are saved, and that\n    consume path swallows the resulting 404, so an unknown team id would silently\n    drop every future user's team assignment unless it is caught here.\n    \"\"\"\n    team_ids: Final = _default_team_ids(teams)\n    if not team_ids:\n        return\n\n    duplicate_ids: Final = tuple(team_id for team_id, count in Counter(team_ids).items() if count > 1)\n    if duplicate_ids:\n        raise HTTPException(\n            status_code=400,\n            detail={\n                \"error\": f\"Duplicate default team id(s): {', '.join(duplicate_ids)}. List each default team only once.\"\n            },\n        )\n\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(\n            status_code=500,\n            detail={\"error\": \"Database not connected. Please connect a database.\"},\n        )\n\n    existing_teams: Final = await TeamRepository(prisma_client).find_many(where={\"team_id\": {\"in\": list(team_ids)}})\n    existing_team_ids: Final = {team.team_id for team in existing_teams}\n    missing_ids: Final = tuple(team_id for team_id in team_ids if team_id not in existing_team_ids)\n    if missing_ids:","sourceCodeStart":683,"sourceCodeEnd":719,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py#L683-L719","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:701 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove duplicate team ids from the default teams list so each team appears only once."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}