{"record":{"id":"e17951886d1fa356","repo":"BerriAI/litellm","slug":"potential-non-existent-or-duplicate-user-email-in","errorCode":null,"errorMessage":"Potential NON-Existent or Duplicate user email in DB: Error finding a unique instance of user_email={member.user_email} in LiteLLM_UserTable.: {e}","messagePattern":"Potential NON-Existent or Duplicate user email in DB: Error finding a unique instance of user_email=(.+?) in LiteLLM_UserTable\\.: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/organization_endpoints.py","lineNumber":1524,"sourceCode":"    \"\"\"\n\n    try:\n        user_object: LiteLLM_UserTable | None = None\n        existing_user_id_row = None\n        existing_user_email_row = None\n        ## Check if user exists in LiteLLM_UserTable - user exists - either the user_id or user_email is in LiteLLM_UserTable\n        if member.user_id is not None:\n            existing_user_id_row = await _table(UserRepository(prisma_client)).find_unique(\n                where={\"user_id\": member.user_id}\n            )\n\n        if existing_user_id_row is None and member.user_email is not None:\n            try:\n                existing_user_email_row = await UserRepository(prisma_client).table.find_unique(\n                    where={\"user_email\": member.user_email}\n                )\n            except Exception as e:\n                raise ValueError(\n                    f\"Potential NON-Existent or Duplicate user email in DB: Error finding a unique instance of user_email={member.user_email} in LiteLLM_UserTable.: {e}\"\n                )\n\n        ## If user does not exist, create a new user\n        if existing_user_id_row is None and existing_user_email_row is None:\n            # Create a new user - since user does not exist\n            user_id: Final[str] = member.user_id or str(uuid.uuid4())\n            new_user_defaults: Final = get_new_internal_user_defaults(\n                user_id=user_id,\n                user_email=member.user_email,\n            )\n\n            _returned_user = await prisma_client.insert_data(data=new_user_defaults, table_name=\"user\")\n            if _returned_user is not None:\n                user_object = LiteLLM_UserTable.model_validate(_returned_user.model_dump())\n        elif existing_user_email_row is not None and len(existing_user_email_row) > 1:\n            raise HTTPException(\n                status_code=400,","sourceCodeStart":1506,"sourceCodeEnd":1542,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/organization_endpoints.py#L1506-L1542","documentation":"When a member is supplied only by user_email, the unique lookup on LiteLLM_UserTable throws (email absent or duplicated). add_member converts that Prisma failure into a ValueError telling the caller the email is non-existent or not unique. The at-fault input is member.user_email that cannot be resolved to exactly one row.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1524 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use user_id instead of user_email; the email is duplicated or non-existent.","Check proxy logs for the underlying lookup error."],"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"}