{"record":{"id":"8348b1f26332f936","repo":"BerriAI/litellm","slug":"violated-content-safety-policy-8348b1","errorCode":null,"errorMessage":"Violated content safety policy","messagePattern":"Violated content safety policy","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py","lineNumber":105,"sourceCode":"                    if typed_cat_scores[\"jailbreak\"] >= self.category_thresholds[\"jailbreak\"]:\n                        raise HTTPException(\n                            status_code=400,\n                            detail={\n                                \"error\": \"Violated jailbreak threshold\",\n                                \"lakera_ai_response\": response,\n                            },\n                        )\n                if \"prompt_injection\" in typed_cat_scores and \"prompt_injection\" in self.category_thresholds:\n                    if typed_cat_scores[\"prompt_injection\"] >= self.category_thresholds[\"prompt_injection\"]:\n                        raise HTTPException(\n                            status_code=400,\n                            detail={\n                                \"error\": \"Violated prompt_injection threshold\",\n                                \"lakera_ai_response\": response,\n                            },\n                        )\n        elif flagged is True:\n            raise HTTPException(\n                status_code=400,\n                detail={\n                    \"error\": \"Violated content safety policy\",\n                    \"lakera_ai_response\": response,\n                },\n            )\n\n        return\n\n    async def _check(\n        self,\n        data: dict,\n        user_api_key_dict: UserAPIKeyAuth,\n        call_type: Literal[\n            \"completion\",\n            \"text_completion\",\n            \"embeddings\",\n            \"image_generation\",","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py#L87-L123","documentation":"Error \"Violated content safety policy\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py:105 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Modify the request to remove content that violates the configured content safety policy.","Review the enabled moderation categories and thresholds in the guardrail configuration."],"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-14T00:17:10.932Z"}