{"record":{"id":"3988ed2c3df5b225","repo":"BerriAI/litellm","slug":"no-database-connected-3988ed","errorCode":null,"errorMessage":"No database connected","messagePattern":"No database connected","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/scim/scim_v2.py","lineNumber":258,"sourceCode":"    existing_member_ids: list[str]\n    created_users: list[NewUserResponse]\n    all_member_ids: list[str]  # existing + newly created\n\n\nscim_router: Final = APIRouter(\n    prefix=\"/scim/v2\",\n    tags=[\"✨ SCIM v2 (Enterprise Only)\"],\n    dependencies=[Depends(_premium_user_check)],\n)\n\n\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()","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/scim/scim_v2.py#L240-L276","documentation":"_get_prisma_client_or_raise_exception in the SCIM router: the sentinel check that converts a missing global prisma_client into HTTPException 500 'No database connected'. SCIM reads/writes user and team tables, so without a DB no operation can proceed; the at-fault condition is proxy configuration.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/scim/scim_v2.py:258 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set DATABASE_URL to a PostgreSQL connection string and restart the proxy."],"exampleFix":null,"handlingStrategy":"fallback","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"}