BerriAI/litellm · error · Exception

GuardrailsAIException - Please pass the Guardrails AI guard

Error message

GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'

What it means

Error "GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/__init__.py:15

from typing import TYPE_CHECKING, Final

from litellm.types.guardrails import SupportedGuardrailIntegrations

from .guardrails_ai import GuardrailsAI

if TYPE_CHECKING:
    from litellm.types.guardrails import Guardrail, LitellmParams


def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"):
    import litellm

    if litellm_params.guard_name is None:
        raise Exception(
            "GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'"
        )

    _guardrails_ai_callback: Final = GuardrailsAI(
        api_base=litellm_params.api_base,
        api_key=litellm_params.api_key,
        guardrail_name=guardrail.get("guardrail_name", ""),
        event_hook=litellm_params.mode,
        default_on=litellm_params.default_on,
        guard_name=litellm_params.guard_name,
        guardrails_ai_api_input_format=getattr(litellm_params, "guardrails_ai_api_input_format", "llmOutput"),
    )
    litellm.logging_callback_manager.add_litellm_callback(_guardrails_ai_callback)

    return _guardrails_ai_callback


guardrail_initializer_registry: Final = {

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set guard_name in litellm_params of the guardrail config, e.g. litellm_params: {guard_name: my_guard}.
  2. Verify the guard name matches a guard that exists in your Guardrails AI account.
  3. Reload the proxy config after adding guard_name.

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/__init__.py:15 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/faf559cd13c3e431. Report an issue: GitHub.