{"record":{"id":"ce5d7a284ea342aa","repo":"BerriAI/litellm","slug":"violated-prompt-injection-threshold","errorCode":null,"errorMessage":"Violated prompt_injection threshold","messagePattern":"Violated prompt_injection threshold","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py","lineNumber":97,"sourceCode":"        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,\n                detail={\n                    \"error\": \"Violated content safety policy\",\n                    \"lakera_ai_response\": response,\n                },\n            )\n\n        return\n\n    async def _check(","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py#L79-L115","documentation":"Error \"Violated prompt_injection threshold\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/lakera_ai.py:97 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise the prompt_injection threshold in the lakera_ai guardrail config for false positives.","Remove injection-like content (e.g. instructions to ignore prior rules) from the request."],"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"}