BerriAI/litellm · error · HTTPException
db_not_connected_error
db_not_connected_error
Error message
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
What it means
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.
Source
Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:784
async def _set_model_blocked_status(
data: BlockModelRequest,
user_api_key_dict: UserAPIKeyAuth,
blocked: bool,
action: Literal["blocked", "unblocked"],
litellm_changed_by: str | None,
) -> LiteLLM_ProxyModelTable | None:
from litellm.proxy.proxy_server import (
litellm_proxy_admin_name,
llm_router,
prisma_client,
store_model_in_db,
)
try:
if prisma_client is None:
raise HTTPException(
status_code=500,
detail={"error": CommonProxyErrors.db_not_connected_error.value},
)
if store_model_in_db is not True:
raise ProxyException(
message="Model updates only supported for DB-stored models",
type=ProxyErrorTypes.validation_error.value,
code=status.HTTP_400_BAD_REQUEST,
param=None,
)
if user_api_key_dict.user_role != LitellmUserRoles.PROXY_ADMIN:
raise ProxyException(
message="Only proxy admins can change a model's blocked flag.",
type=ProxyErrorTypes.auth_error.value,
code=status.HTTP_403_FORBIDDEN,
param="blocked",View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set DATABASE_URL to a PostgreSQL connection string and restart the proxy.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/management_endpoints/model_management_endpoints.py:784 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/eef3317d4f1fceb5.
Report an issue: GitHub.