BerriAI/litellm · error · ValueError

No callback found for guardrail: {guardrail_name}

Error message

No callback found for guardrail: {guardrail_name}

What it means

After the router selected a deployment for the named guardrail, no CustomGuardrail callback was found under that guardrail_name in the loaded callbacks. The config references a guardrail that was never registered (typo in the name, or the guardrail block failed to load), so there is nothing to execute.

Source

Thrown at litellm/proxy/utils.py:1072

            data: Request data
            user_api_key_dict: User API key auth
            call_type: Type of call
            response: Response object (for post_call hooks)

        Returns:
            Result from the guardrail execution
        """
        from litellm.proxy.proxy_server import llm_router

        if llm_router is None:
            raise ValueError("Router not initialized")

        # Select guardrail using router's load balancing
        selected_guardrail: Final = llm_router.get_available_guardrail(guardrail_name=guardrail_name)

        callback: Final[CustomGuardrail | None] = selected_guardrail.get("callback")
        if callback is None:
            raise ValueError(f"No callback found for guardrail: {guardrail_name}")

        return await self._execute_guardrail_hook(
            callback=callback,
            hook_type=hook_type,
            data=data,
            user_api_key_dict=user_api_key_dict,
            call_type=call_type,
            response=response,
        )

    async def _process_guardrail_callback(
        self,
        callback: CustomGuardrail,
        data: dict,
        user_api_key_dict: UserAPIKeyAuth | None,
        call_type: CallTypesLiteral,
        event_type: GuardrailEventHooks,
    ) -> dict | None:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Register a callback for the named guardrail or correct the guardrail_name in your config.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/utils.py:1072 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/55f49b5054c4073b. Report an issue: GitHub.