{"record":{"id":"09cac9e065348ac2","repo":"BerriAI/litellm","slug":"couldn-t-get-lasso-api-key-either-set-the-lasso","errorCode":null,"errorMessage":"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","messagePattern":"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","errorType":"exception","errorClass":"LassoGuardrailMissingSecrets","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py","lineNumber":106,"sourceCode":"    def __init__(\n        self,\n        lasso_api_key: str | None = None,\n        api_key: str | None = None,\n        api_base: str | None = None,\n        user_id: str | None = None,\n        conversation_id: str | None = None,\n        mask: bool | None = False,\n        **kwargs,\n    ):\n        kwargs.setdefault(\"supported_event_hooks\", list(self.get_supported_event_hooks()))\n        self.async_handler = get_async_httpx_client(llm_provider=httpxSpecialProvider.GuardrailCallback)\n        self.lasso_api_key = lasso_api_key or api_key or os.environ.get(\"LASSO_API_KEY\")\n        self.user_id = user_id or os.environ.get(\"LASSO_USER_ID\")\n        self.conversation_id = conversation_id or os.environ.get(\"LASSO_CONVERSATION_ID\")\n        self.mask = mask or False\n\n        if self.lasso_api_key is None:\n            raise LassoGuardrailMissingSecrets(\n                \"Couldn't get Lasso api key, either set the `LASSO_API_KEY` in the environment or \"\n                \"pass it as a parameter to the guardrail in the config file\"\n            )\n\n        self.api_base = api_base or os.getenv(\"LASSO_API_BASE\") or \"https://server.lasso.security/gateway/v3\"\n\n        verbose_proxy_logger.debug(\n            \"Lasso guardrail initialized: %s, event_hook: %s, mask: %s\",\n            kwargs.get(\"guardrail_name\", \"unknown\"),\n            kwargs.get(\"event_hook\", \"unknown\"),\n            self.mask,\n        )\n\n        super().__init__(**kwargs)\n\n    @staticmethod\n    def _get_field(obj: Any, field: str, default: object = None) -> Any:\n        \"\"\"Get a field from either a dict or a Pydantic object.\"\"\"","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py#L88-L124","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py:106 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the LASSO_API_KEY environment variable for the proxy process.","Or pass api_key in the lasso guardrail's litellm_params in the config file."],"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"}