BerriAI/litellm · error · HTTPException

Team={data.team_id} was deleted while this member add was ru

Error message

Team={data.team_id} was deleted while this member add was running

What it means

Error "Team={data.team_id} was deleted while this member add was running" thrown in BerriAI/litellm.

Source

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

    """
    # Process and add new members
    updated_users, updated_team_memberships = await _process_team_members(
        data=data,
        complete_team_data=complete_team_data,
        prisma_client=prisma_client,
        user_api_key_dict=user_api_key_dict,
        litellm_proxy_admin_name=litellm_proxy_admin_name,
    )

    updated_team: Final = await _write_members_with_roles_locked(
        data=data,
        complete_team_data=complete_team_data,
        prisma_client=prisma_client,
        updated_users=updated_users,
    )
    if updated_team is None:
        await _sweep_deleted_team_references(team_ids=(data.team_id,), prisma_client=prisma_client)
        raise HTTPException(
            status_code=404,
            detail={"error": f"Team={data.team_id} was deleted while this member add was running"},
        )

    return updated_team, updated_users, updated_team_memberships


async def _write_members_with_roles_locked(
    data: TeamMemberAddRequest,
    complete_team_data: LiteLLM_TeamTable,
    prisma_client: PrismaClient,
    updated_users: list[LiteLLM_UserTable],
) -> LiteLLM_TeamTable | None:
    """Reconcile members_with_roles under the team row lock. None when the team row is gone.

    That read is at least as recent as the user and membership writes the caller
    already made, so a missing row means /team/delete committed after them. Its
    post-delete sweep can have run before those writes landed, which is why the

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The team was deleted concurrently; re-check that the team exists and retry the member add.

When it happens

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