{"record":{"id":"eef3317d4f1fceb5","repo":"BerriAI/litellm","slug":"db-not-connected-error","errorCode":"db_not_connected_error","errorMessage":"DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.litellm.ai/docs/proxy/virtual_keys","messagePattern":"DB not connected\\. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string \\(postgresql://\\.\\.\\.\\) to enable it\\. See https://docs\\.litellm\\.ai/docs/proxy/virtual_keys","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/model_management_endpoints.py","lineNumber":784,"sourceCode":"\n\nasync def _set_model_blocked_status(\n    data: BlockModelRequest,\n    user_api_key_dict: UserAPIKeyAuth,\n    blocked: bool,\n    action: Literal[\"blocked\", \"unblocked\"],\n    litellm_changed_by: str | None,\n) -> LiteLLM_ProxyModelTable | None:\n    from litellm.proxy.proxy_server import (\n        litellm_proxy_admin_name,\n        llm_router,\n        prisma_client,\n        store_model_in_db,\n    )\n\n    try:\n        if prisma_client is None:\n            raise HTTPException(\n                status_code=500,\n                detail={\"error\": CommonProxyErrors.db_not_connected_error.value},\n            )\n\n        if store_model_in_db is not True:\n            raise ProxyException(\n                message=\"Model updates only supported for DB-stored models\",\n                type=ProxyErrorTypes.validation_error.value,\n                code=status.HTTP_400_BAD_REQUEST,\n                param=None,\n            )\n\n        if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:\n            raise ProxyException(\n                message=\"Only proxy admins can change a model's blocked flag.\",\n                type=ProxyErrorTypes.auth_error.value,\n                code=status.HTTP_403_FORBIDDEN,\n                param=\"blocked\",","sourceCodeStart":766,"sourceCodeEnd":802,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/model_management_endpoints.py#L766-L802","documentation":"Error \"DB not connected. This endpoint needs a database; set DATABASE_URL to a PostgreSQL connection string (postgresql://...) to enable it. See https://docs.litellm.ai/docs/proxy/virtual_keys\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:784 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":"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"}