BerriAI/litellm · error · HTTPException

IP address already exists

Error message

IP address already exists

What it means

Idempotency guard in add_allowed_ip: the submitted IP is already present in general_settings['allowed_ips'], so adding it again would create a duplicate entry. The client does not need to retry; the desired state already holds.

Source

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

    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:
        config["general_settings"] = {}

    if "allowed_ips" not in config["general_settings"]:
        config["general_settings"]["allowed_ips"] = []

    before_allowed_ips: Final = list(config["general_settings"]["allowed_ips"])
    if ip_address.ip not in config["general_settings"]["allowed_ips"]:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The IP address is already in the allow/block list; update or delete the existing entry instead.
Defensive patterns

Strategy: validation

When it happens

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