{"record":{"id":"1adb9d5bb6e3c62b","repo":"BerriAI/litellm","slug":"user-not-found-with-id-user-id","errorCode":null,"errorMessage":"User not found with ID: {user_id}","messagePattern":"User not found with ID: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/management_endpoints/scim/scim_v2.py","lineNumber":269,"sourceCode":"\n# Helper functions for common operations\nasync def _get_prisma_client_or_raise_exception():\n    \"\"\"Check if database is connected and raise HTTPException if not.\"\"\"\n    from litellm.proxy.proxy_server import prisma_client\n\n    if prisma_client is None:\n        raise HTTPException(status_code=500, detail={\"error\": \"No database connected\"})\n    return prisma_client\n\n\nasync def _check_user_exists(user_id: str) -> LiteLLM_UserTable:\n    \"\"\"Check if user exists and return user, raise 404 if not found.\"\"\"\n    prisma_client: Final = await _get_prisma_client_or_raise_exception()\n\n    user: Final = await _table(UserRepository(prisma_client)).find_unique(where={\"user_id\": user_id})\n\n    if not user:\n        raise HTTPException(status_code=404, detail={\"error\": f\"User not found with ID: {user_id}\"})\n\n    return user\n\n\nasync def _check_team_exists(team_id: str) -> LiteLLM_TeamTable:\n    \"\"\"Check if team exists and return team, raise 404 if not found.\"\"\"\n    prisma_client: Final = await _get_prisma_client_or_raise_exception()\n\n    team: Final = await _table(TeamRepository(prisma_client)).find_unique(where={\"team_id\": team_id})\n\n    if not team:\n        raise HTTPException(status_code=404, detail={\"error\": f\"Group not found with ID: {team_id}\"})\n\n    return team\n\n\ndef _extract_scim_user_data(user: SCIMUser) -> ScimUserData:\n    \"\"\"Extract common data from SCIMUser object.\"\"\"","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/scim/scim_v2.py#L251-L287","documentation":"_check_user_exists performs find_unique on LiteLLM_UserTable by user_id and gets None: the SCIM caller addressed a user id that does not exist. Raised as 404 so SCIM clients get the standard not-found semantics.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/scim/scim_v2.py:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the user ID. List users via GET /Users to find valid IDs."],"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"}