{"record":{"id":"faf559cd13c3e431","repo":"BerriAI/litellm","slug":"guardrailsaiexception-please-pass-the-guardrails","errorCode":null,"errorMessage":"GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'","messagePattern":"GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/__init__.py","lineNumber":15,"sourceCode":"from typing import TYPE_CHECKING, Final\n\nfrom litellm.types.guardrails import SupportedGuardrailIntegrations\n\nfrom .guardrails_ai import GuardrailsAI\n\nif TYPE_CHECKING:\n    from litellm.types.guardrails import Guardrail, LitellmParams\n\n\ndef initialize_guardrail(litellm_params: \"LitellmParams\", guardrail: \"Guardrail\"):\n    import litellm\n\n    if litellm_params.guard_name is None:\n        raise Exception(\n            \"GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'\"\n        )\n\n    _guardrails_ai_callback: Final = GuardrailsAI(\n        api_base=litellm_params.api_base,\n        api_key=litellm_params.api_key,\n        guardrail_name=guardrail.get(\"guardrail_name\", \"\"),\n        event_hook=litellm_params.mode,\n        default_on=litellm_params.default_on,\n        guard_name=litellm_params.guard_name,\n        guardrails_ai_api_input_format=getattr(litellm_params, \"guardrails_ai_api_input_format\", \"llmOutput\"),\n    )\n    litellm.logging_callback_manager.add_litellm_callback(_guardrails_ai_callback)\n\n    return _guardrails_ai_callback\n\n\nguardrail_initializer_registry: Final = {","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/__init__.py#L1-L33","documentation":"Error \"GuardrailsAIException - Please pass the Guardrails AI guard name via 'litellm_params::guard_name'\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/guardrails_ai/__init__.py:15 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set guard_name in litellm_params of the guardrail config, e.g. litellm_params: {guard_name: my_guard}.","Verify the guard name matches a guard that exists in your Guardrails AI account.","Reload the proxy config after adding guard_name."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}