BerriAI/litellm · error · LassoGuardrailMissingSecrets

Couldn't get Lasso api key, either set the `LASSO_API_KEY` i

Error message

Couldn't get Lasso api key, either set the `LASSO_API_KEY` in the environment or pass it as a parameter to the guardrail in the config file

What it means

Error "Couldn't get Lasso api key, either set the `LASSO_API_KEY` in the environment or pass it as a parameter to the guardrail in the config file" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py:106

    def __init__(
        self,
        lasso_api_key: str | None = None,
        api_key: str | None = None,
        api_base: str | None = None,
        user_id: str | None = None,
        conversation_id: str | None = None,
        mask: bool | None = False,
        **kwargs,
    ):
        kwargs.setdefault("supported_event_hooks", list(self.get_supported_event_hooks()))
        self.async_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.GuardrailCallback)
        self.lasso_api_key = lasso_api_key or api_key or os.environ.get("LASSO_API_KEY")
        self.user_id = user_id or os.environ.get("LASSO_USER_ID")
        self.conversation_id = conversation_id or os.environ.get("LASSO_CONVERSATION_ID")
        self.mask = mask or False

        if self.lasso_api_key is None:
            raise LassoGuardrailMissingSecrets(
                "Couldn't get Lasso api key, either set the `LASSO_API_KEY` in the environment or "
                "pass it as a parameter to the guardrail in the config file"
            )

        self.api_base = api_base or os.getenv("LASSO_API_BASE") or "https://server.lasso.security/gateway/v3"

        verbose_proxy_logger.debug(
            "Lasso guardrail initialized: %s, event_hook: %s, mask: %s",
            kwargs.get("guardrail_name", "unknown"),
            kwargs.get("event_hook", "unknown"),
            self.mask,
        )

        super().__init__(**kwargs)

    @staticmethod
    def _get_field(obj: Any, field: str, default: object = None) -> Any:
        """Get a field from either a dict or a Pydantic object."""

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set the LASSO_API_KEY environment variable for the proxy process.
  2. Or pass api_key in the lasso guardrail's litellm_params in the config file.

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py:106 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/09cac9e065348ac2. Report an issue: GitHub.