BerriAI/litellm · error · HTTPException

Guardrail with name {request.guardrail_name!r} already exist

Error message

Guardrail with name {request.guardrail_name!r} already exists

What it means

Raised during generic-guardrail registration when a database lookup finds an existing guardrail row with the same guardrail_name. Guardrail names are unique keys in the registry and DB, so a duplicate registration is rejected with HTTP 400 rather than silently overwriting the existing guardrail's configuration.

Source

Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:755

            status_code=400,
            detail="litellm_params.api_base must use http or https scheme",
        )
    if not parsed.hostname:
        raise HTTPException(
            status_code=400,
            detail="litellm_params.api_base must contain a valid hostname",
        )
    mode: Final = params.get("mode")
    if mode is None:
        raise HTTPException(
            status_code=400,
            detail="litellm_params.mode is required (e.g. pre_call, post_call)",
        )

    try:
        existing = await _guardrails_table(prisma_client).find_unique(where={"guardrail_name": request.guardrail_name})
        if existing is not None:
            raise HTTPException(
                status_code=400,
                detail=f"Guardrail with name {request.guardrail_name!r} already exists",
            )
    except HTTPException:
        raise
    except Exception as e:
        verbose_proxy_logger.exception("Error checking guardrail name uniqueness: %s", e)
        raise HTTPException(status_code=500, detail=str(e))

    now: Final = datetime.now(timezone.utc)
    litellm_params_str: Final = safe_dumps(params)
    guardrail_info: Final = dict(request.guardrail_info or {})
    guardrail_info["submitted_by_user_id"] = user_api_key_dict.user_id
    guardrail_info["submitted_by_email"] = user_api_key_dict.user_email
    guardrail_info["team_guardrail"] = True  # Mark as team submission for filtering/display
    guardrail_info_str: Final = safe_dumps(guardrail_info)

    try:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Choose a different guardrail_name, or update/delete the existing guardrail with that name.

Example fix

Use a unique guardrail_name in the create request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_endpoints.py:755 when the library encounters an invalid state.

Common situations: A guardrail with the same name already exists.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/10c1259728fe6c8e. Report an issue: GitHub.