{"record":{"id":"06c21723c5649140","repo":"BerriAI/litellm","slug":"group-already-exists-with-id-team-id","errorCode":null,"errorMessage":"Group already exists with ID: {team_id}","messagePattern":"Group already exists with ID: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"error","filePath":"litellm/proxy/management_endpoints/scim/scim_v2.py","lineNumber":2123,"sourceCode":"):\n    \"\"\"\n    Create a group according to SCIM v2 protocol\n    \"\"\"\n    verbose_proxy_logger.debug(\n        \"SCIM CREATE GROUP request: %s\",\n        group.model_dump(),\n    )\n    try:\n        prisma_client: Final = await _get_prisma_client_or_raise_exception()\n\n        # Generate ID if not provided\n        team_id: Final = group.id or group.externalId or str(uuid.uuid4())\n\n        # Check if team already exists\n        existing_team: Final = await _table(TeamRepository(prisma_client)).find_unique(where={\"team_id\": team_id})\n\n        if existing_team:\n            raise HTTPException(\n                status_code=409,\n                detail={\"error\": f\"Group already exists with ID: {team_id}\"},\n            )\n\n        # Extract and validate group members (all users must exist)\n        member_result: Final = await _extract_group_member_ids(group)\n        members_with_roles = [Member(user_id=member_id, role=\"user\") for member_id in member_result.all_member_ids]\n\n        # Create team in database\n        created_team: Final = await new_team(\n            data=NewTeamRequest(\n                team_id=team_id,\n                team_alias=group.displayName,\n                members_with_roles=members_with_roles,\n                metadata={SCIM_MANAGED_TEAM_METADATA_KEY: True},\n            ),\n            http_request=Request(scope={\"type\": \"http\", \"path\": \"/scim/v2/Groups\"}),\n            user_api_key_dict=UserAPIKeyAuth(user_role=LitellmUserRoles.PROXY_ADMIN),","sourceCodeStart":2105,"sourceCodeEnd":2141,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/scim/scim_v2.py#L2105-L2141","documentation":"SCIM POST /Groups: the generated or supplied team_id (group.id or externalId) already maps to an existing LiteLLM team, so creating a duplicate group is refused with a conflict HTTPException. At-fault input is a group id colliding with an existing team.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/scim/scim_v2.py:2123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a different group ID, or update the existing group via PATCH /Groups/{id}."],"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"}