BerriAI/litellm · error · HTTPException
User not found for user_id={member.user_id} and user_email={
Error message
User not found for user_id={member.user_id} and user_email={member.user_email} What it means
Neither the provided user_id nor user_email matched any LiteLLM_UserTable row and no lookup key was resolvable, so the member-creation path has no user to attach to the organization. Raised as 404; the at-fault input is member identifiers that reference no existing user.
Source
Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1550
new_user_defaults: Final = get_new_internal_user_defaults(
user_id=user_id,
user_email=member.user_email,
)
_returned_user = await prisma_client.insert_data(data=new_user_defaults, table_name="user")
if _returned_user is not None:
user_object = LiteLLM_UserTable.model_validate(_returned_user.model_dump())
elif existing_user_email_row is not None and len(existing_user_email_row) > 1:
raise HTTPException(
status_code=400,
detail={"error": "Multiple users with this email found in db. Please use 'user_id' instead."},
)
elif existing_user_email_row is not None:
user_object = LiteLLM_UserTable.model_validate(existing_user_email_row.model_dump())
elif existing_user_id_row is not None:
user_object = LiteLLM_UserTable.model_validate(existing_user_id_row.model_dump())
else:
raise HTTPException(
status_code=404,
detail={"error": f"User not found for user_id={member.user_id} and user_email={member.user_email}"},
)
if user_object is None:
raise ValueError(
f"User does not exist in LiteLLM_UserTable. user_id={member.user_id} and user_email={member.user_email}"
)
# Add user to organization
_organization_membership: Final = await _table(OrganizationMembershipRepository(prisma_client)).create(
data={
"organization_id": organization_id,
"user_id": user_object.user_id,
"user_role": member.role,
}
)
organization_membership: Final = LiteLLM_OrganizationMembershipTable.model_validate(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Verify the user_id/user_email exists in LiteLLM_UserTable via /user/list.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1550 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/61fcc028199a9912.
Report an issue: GitHub.