{"record":{"id":"93937d7decc01f2f","repo":"BerriAI/litellm","slug":"multiple-users-with-this-email-found-in-db-please-93937d","errorCode":null,"errorMessage":"Multiple users with this email found in db. Please use 'user_id' instead.","messagePattern":"Multiple users with this email found in db\\. Please use 'user_id' instead\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_helpers/utils.py","lineNumber":333,"sourceCode":"        ## user email is not unique acc. to prisma schema -> future improvement\n        ### for now: check if it exists in db, if not - insert it\n        existing_user_row: Final[list | None] = await prisma_client.get_data(\n            key_val={\"user_email\": new_member.user_email},\n            table_name=\"user\",\n            query_type=\"find_all\",\n        )\n        if existing_user_row is None or (isinstance(existing_user_row, list) and len(existing_user_row) == 0):\n            new_user_defaults[\"teams\"] = [team_id]\n            _returned_user = await prisma_client.insert_data(data=new_user_defaults, table_name=\"user\")\n\n            if _returned_user is not None:\n                returned_user = LiteLLM_UserTable.model_validate(_returned_user.model_dump())\n        elif len(existing_user_row) == 1:\n            user_info: Final = existing_user_row[0]\n            await _append_team_id_if_absent(prisma_client, user_info.user_id, team_id)\n            returned_user = LiteLLM_UserTable.model_validate(user_info.model_dump())\n        elif len(existing_user_row) > 1:\n            raise HTTPException(\n                status_code=400,\n                detail={\"error\": \"Multiple users with this email found in db. Please use 'user_id' instead.\"},\n            )\n\n    _budget_id: Final = await _resolve_member_budget_id(\n        prisma_client=prisma_client,\n        user_api_key_dict=user_api_key_dict,\n        litellm_proxy_admin_name=litellm_proxy_admin_name,\n        max_budget_in_team=max_budget_in_team,\n        allowed_models=allowed_models,\n        budget_duration=budget_duration,\n        default_team_budget_id=default_team_budget_id,\n    )\n\n    if _budget_id and returned_user is not None and returned_user.user_id is not None:\n        _returned_team_membership: Final = await TeamMembershipRepository(prisma_client).table.create(\n            data={\n                \"team_id\": team_id,","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_helpers/utils.py#L315-L351","documentation":"HTTPException raised while adding a team member by email: the lookup on LiteLLM_UserTable found multiple rows with the same user_email (email is not unique in the schema), so the member to add is ambiguous. The caller must disambiguate by passing user_id instead of email.","triggerScenarios":"Thrown at litellm/proxy/management_helpers/utils.py:333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use user_id instead of email to disambiguate between the multiple matching users."],"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-14T05:17:10.506Z"}