{"record":{"id":"c5244787c7201d41","repo":"BerriAI/litellm","slug":"violated-jailbreak-threshold","errorCode":null,"errorMessage":"Violated jailbreak threshold","messagePattern":"Violated jailbreak threshold","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py","lineNumber":88,"sourceCode":"        self.api_base = api_base or get_secret(\"LAKERA_API_BASE\") or \"https://api.lakera.ai\"\n        super().__init__(**kwargs)\n\n    #### CALL HOOKS - proxy only ####\n    def _check_response_flagged(self, response: dict) -> None:\n        _results: Final = response.get(\"results\", [])\n        if len(_results) <= 0:\n            return\n\n        flagged: Final = _results[0].get(\"flagged\", False)\n        category_scores: Final[dict | None] = _results[0].get(\"category_scores\", None)\n\n        if self.category_thresholds is not None:\n            if category_scores is not None:\n                typed_cat_scores: Final = LakeraCategoryThresholds(**category_scores)\n                if \"jailbreak\" in typed_cat_scores and \"jailbreak\" in self.category_thresholds:\n                    # check if above jailbreak threshold\n                    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,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py#L70-L106","documentation":"Error \"Violated jailbreak threshold\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py:88 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the jailbreak threshold in the lakera_ai guardrail config if legitimate prompts are being flagged.","Rephrase the request to remove jailbreak-like phrasing."],"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"}