BerriAI/litellm · error · Exception

No DB Connected

Error message

No DB Connected

What it means

Guard in add_allowed_ip: prisma_client is None, so the proxy is running without a database connection. The IP allowlist feature persists config via Prisma, so the request cannot proceed until DATABASE_URL points at a working database.

Source

Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:464

@router.post(
    "/add/allowed_ip",
    tags=["Budget & Spend Tracking"],
    dependencies=[Depends(user_api_key_auth)],
)
async def add_allowed_ip(
    ip_address: IPAddress,
    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),
):
    from litellm.proxy.proxy_server import (
        create_config_audit_log,
        general_settings,
        prisma_client,
        proxy_config,
        store_model_in_db,
    )

    if prisma_client is None:
        raise Exception("No DB Connected")

    _allowed_ips: Final[list] = general_settings.get("allowed_ips", [])
    if ip_address.ip not in _allowed_ips:
        _allowed_ips.append(ip_address.ip)
        general_settings["allowed_ips"] = _allowed_ips
    else:
        raise HTTPException(status_code=400, detail="IP address already exists")

    if store_model_in_db is not True:
        raise HTTPException(
            status_code=500,
            detail={"error": "Set `'STORE_MODEL_IN_DB='True'` in your env to enable this feature."},
        )

    # Load existing config
    config: Final = await proxy_config.get_config()
    verbose_proxy_logger.debug("Loaded config: %s", config)
    if "general_settings" not in config:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set DATABASE_URL to a PostgreSQL connection string and restart the proxy.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:464 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/dc89f40a2db1ec48. Report an issue: GitHub.