BerriAI/litellm · error · HTTPException

Guardrail '{request.guardrail_name}' not found. Please ensur

Error message

Guardrail '{request.guardrail_name}' not found. Please ensure the guardrail is configured in your LiteLLM proxy.

What it means

Raised by the /apply_guardrail endpoint when GUARDRAIL_REGISTRY.get_initialized_guardrail_callback returns None for the requested guardrail_name — no guardrail with that name has been initialized in the running proxy (not in config.yaml, or failed to load). The request is rejected before any text is scanned; the message directs the operator to configure the guardrail first.

Source

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

        version,
    )
    from litellm.proxy.utils import handle_exception_on_proxy

    data: dict = {
        "guardrail_name": request.guardrail_name,
        "input": [request.text],
        "messages": request.messages or [],
        "metadata": {"route": "/apply_guardrail"},
    }
    litellm_logging_obj = None
    start_time: Final = datetime.now(timezone.utc)

    try:
        active_guardrail: Final[CustomGuardrail | None] = GUARDRAIL_REGISTRY.get_initialized_guardrail_callback(
            guardrail_name=request.guardrail_name
        )
        if active_guardrail is None:
            raise HTTPException(
                status_code=404,
                detail=f"Guardrail '{request.guardrail_name}' not found. Please ensure the guardrail is configured in your LiteLLM proxy.",
            )

        request_processor: Final = ProxyBaseLLMRequestProcessing(data=data)
        (
            data,
            litellm_logging_obj,
        ) = await request_processor.common_processing_pre_call_logic(
            request=fastapi_request,
            general_settings=general_settings,
            user_api_key_dict=user_api_key_dict,
            version=version,
            proxy_logging_obj=proxy_logging_obj,
            proxy_config=proxy_config,
            route_type="apply_guardrail",
        )

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Configure the guardrail in the proxy config (guardrails section) with that guardrail_name.
  2. Check the guardrail_name for typos.

Example fix

List configured guardrails via /guardrails/list and use an existing name.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: The request referenced a guardrail name not configured on the proxy.


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