diff --git a/litellm/proxy/management_helpers/utils.py b/litellm/proxy/management_helpers/utils.py index efbe667fb68..af8e8520134 100644 --- a/litellm/proxy/management_helpers/utils.py +++ b/litellm/proxy/management_helpers/utils.py @@ -109,8 +109,8 @@ async def add_new_member( where={"user_id": user_info.user_id}, # type: ignore data={"teams": {"push": [team_id]}}, ) - - returned_user = LiteLLM_UserTable(**_returned_user.model_dump()) + if _returned_user is not None: + returned_user = LiteLLM_UserTable(**_returned_user.model_dump()) elif len(existing_user_row) > 1: raise HTTPException( status_code=400, diff --git a/litellm/tests/test_exceptions.py b/litellm/tests/test_exceptions.py index 0388e026b9f..a570692f6db 100644 --- a/litellm/tests/test_exceptions.py +++ b/litellm/tests/test_exceptions.py @@ -864,7 +864,7 @@ def _pre_call_utils( data["messages"] = [{"role": "user", "content": "Hello world"}] if streaming is True: data["stream"] = True - mapped_target = client.chat.completions.with_raw_response + mapped_target = client.chat.completions.with_raw_response # type: ignore if sync_mode: original_function = litellm.completion else: @@ -873,7 +873,7 @@ def _pre_call_utils( data["prompt"] = "Hello world" if streaming is True: data["stream"] = True - mapped_target = client.completions.with_raw_response + mapped_target = client.completions.with_raw_response # type: ignore if sync_mode: original_function = litellm.text_completion else: