{"record":{"id":"f452ca15728bf404","repo":"BerriAI/litellm","slug":"failed-to-apply-post-call-masking-e","errorCode":null,"errorMessage":"Failed to apply post-call masking: {e}","messagePattern":"Failed to apply post-call masking: (.+?)","errorType":"exception","errorClass":"LassoGuardrailAPIError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py","lineNumber":300,"sourceCode":"                if self.mask:\n                    headers: Final = self._prepare_headers(response_data, global_cache)\n                    payload: Final = self._prepare_payload(response_messages, response_data, global_cache, \"COMPLETION\")\n                    api_url: Final = f\"{self.api_base}/classifix\"\n\n                    try:\n                        lasso_response = await self._call_lasso_api(headers=headers, payload=payload, api_url=api_url)\n                        self._process_lasso_response(lasso_response)\n\n                        # Apply masking to the actual response if masked content is available\n                        masked_messages: Final = lasso_response.get(\"messages\")\n                        if lasso_response.get(\"violations_detected\") and masked_messages:\n                            self._apply_masking_to_model_response(response, masked_messages)\n                            verbose_proxy_logger.debug(\"Applied Lasso masking to model response\")\n                    except Exception as e:\n                        if isinstance(e, HTTPException):\n                            raise e\n                        verbose_proxy_logger.error(\"Error in post-call Lasso masking: %s\", e)\n                        raise LassoGuardrailAPIError(f\"Failed to apply post-call masking: {e}\")\n                else:\n                    # Use the same data for conversation_id consistency (no cache access needed)\n                    await self._run_lasso_guardrail(response_data, cache=global_cache, message_type=\"COMPLETION\")\n                    verbose_proxy_logger.debug(\"Post-call Lasso validation completed\")\n            else:\n                verbose_proxy_logger.warning(\"No response messages found to validate\")\n        else:\n            verbose_proxy_logger.warning(\"Unexpected response type for post-call hook: %s\", type(response))\n\n        return response\n\n    def _get_or_generate_conversation_id(self, data: dict, cache: DualCache) -> str:\n        \"\"\"\n        Get or generate a conversation_id for this request.\n\n        This method ensures session consistency by using litellm_call_id as a cache key.\n        The same conversation_id is used for both pre-call and post-call hooks within\n        the same request, enabling proper conversation grouping in Lasso UI.","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py#L282-L318","documentation":"Error \"Failed to apply post-call masking: {e}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/lasso/lasso.py:300 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the underlying exception message for the masking failure cause.","Verify the Lasso de-identification/masking configuration (entities, masking rules) is valid.","If masking is optional, disable post-call masking or set block_on_error appropriately."],"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"}