{"record":{"id":"b7d0cbbc30166631","repo":"BerriAI/litellm","slug":"user-does-not-exist-in-litellm-usertable-user-id","errorCode":null,"errorMessage":"User does not exist in LiteLLM_UserTable. user_id={member.user_id} and user_email={member.user_email}","messagePattern":"User does not exist in LiteLLM_UserTable\\. user_id=(.+?) and user_email=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/organization_endpoints.py","lineNumber":1556,"sourceCode":"            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,\n                detail={\"error\": \"Multiple users with this email found in db. Please use 'user_id' instead.\"},\n            )\n        elif existing_user_email_row is not None:\n            user_object = LiteLLM_UserTable.model_validate(existing_user_email_row.model_dump())\n        elif existing_user_id_row is not None:\n            user_object = LiteLLM_UserTable.model_validate(existing_user_id_row.model_dump())\n        else:\n            raise HTTPException(\n                status_code=404,\n                detail={\"error\": f\"User not found for user_id={member.user_id} and user_email={member.user_email}\"},\n            )\n\n        if user_object is None:\n            raise ValueError(\n                f\"User does not exist in LiteLLM_UserTable. user_id={member.user_id} and user_email={member.user_email}\"\n            )\n\n        # Add user to organization\n        _organization_membership: Final = await _table(OrganizationMembershipRepository(prisma_client)).create(\n            data={\n                \"organization_id\": organization_id,\n                \"user_id\": user_object.user_id,\n                \"user_role\": member.role,\n            }\n        )\n        organization_membership: Final = LiteLLM_OrganizationMembershipTable.model_validate(\n            _organization_membership.model_dump()\n        )\n        return user_object, organization_membership\n\n    except Exception as e:\n        raise ValueError(f\"Error adding member={member} to organization={organization_id}: {e}\")","sourceCodeStart":1538,"sourceCodeEnd":1574,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/organization_endpoints.py#L1538-L1574","documentation":"Raised inside add_member when both user_id and user_email lookups fail and no new user could be created: the referenced member simply does not exist in LiteLLM_UserTable. It surfaces as a ValueError that the caller converts into an HTTP error; at-fault input is an unknown member identifier.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/organization_endpoints.py:1556 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the user first via /user/new, then add them to the organization."],"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-14T00:17:10.932Z"}