{"record":{"id":"d384c4776fafd284","repo":"BerriAI/litellm","slug":"blocked-by-akto-guardrails","errorCode":null,"errorMessage":"Blocked by Akto Guardrails","messagePattern":"Blocked by Akto Guardrails","errorType":"http","errorClass":"HTTPException","httpStatus":403,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/akto/akto.py","lineNumber":441,"sourceCode":"                blocked_payload[\"responsePayload\"] = json.dumps(\n                    {\n                        \"body\": json.dumps({\"x-blocked-by\": \"Akto Proxy\", \"reason\": reason}),\n                    }\n                )\n                blocked_payload[\"responseHeaders\"] = json.dumps(\n                    {\"content-type\": \"application/json\"},\n                )\n                # Fire-and-forget ingest of the blocked request, then raise 403\n                task = asyncio.create_task(\n                    self.fire_and_forget_request(\n                        guardrails=False,\n                        ingest_data=True,\n                        payload=blocked_payload,\n                    )\n                )\n                self.background_tasks.add(task)\n                task.add_done_callback(self.background_tasks.discard)\n                raise HTTPException(\n                    status_code=403,\n                    detail=reason or \"Blocked by Akto Guardrails\",\n                )\n\n        elif input_type == \"response\":\n            # Post_call: fire-and-forget combined guardrail + ingest\n            payload = self.build_akto_payload(inputs, request_data, include_response=True)\n            task = asyncio.create_task(\n                self.fire_and_forget_request(\n                    guardrails=True,\n                    ingest_data=True,\n                    payload=payload,\n                )\n            )\n            self.background_tasks.add(task)\n            task.add_done_callback(self.background_tasks.discard)\n\n        return inputs","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/akto/akto.py#L423-L459","documentation":"Raised when Akto's decision API flags the request/response as violating policy: the guardrail blocks the call (HTTP 403 family) after firing a fire-and-forget ingest of the blocked payload for audit.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:441 when the library encounters an invalid state.","commonSituations":"The Akto guardrail detected a policy violation in the request or response.","solutions":["Review the flagged content and remove policy-violating material.","If the block is a false positive, adjust the Akto guardrail policy or thresholds."],"exampleFix":"Inspect the Akto dashboard for the violation details and modify the request accordingly.","handlingStrategy":"validation","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"}