BerriAI/litellm · error · HTTPException
Blocked by Akto Guardrails
Error message
Blocked by Akto Guardrails
What it means
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.
Source
Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:441
blocked_payload["responsePayload"] = json.dumps(
{
"body": json.dumps({"x-blocked-by": "Akto Proxy", "reason": reason}),
}
)
blocked_payload["responseHeaders"] = json.dumps(
{"content-type": "application/json"},
)
# Fire-and-forget ingest of the blocked request, then raise 403
task = asyncio.create_task(
self.fire_and_forget_request(
guardrails=False,
ingest_data=True,
payload=blocked_payload,
)
)
self.background_tasks.add(task)
task.add_done_callback(self.background_tasks.discard)
raise HTTPException(
status_code=403,
detail=reason or "Blocked by Akto Guardrails",
)
elif input_type == "response":
# Post_call: fire-and-forget combined guardrail + ingest
payload = self.build_akto_payload(inputs, request_data, include_response=True)
task = asyncio.create_task(
self.fire_and_forget_request(
guardrails=True,
ingest_data=True,
payload=payload,
)
)
self.background_tasks.add(task)
task.add_done_callback(self.background_tasks.discard)
return inputsView on GitHub (pinned to 77b7c6c40c)
Solutions
- Review the flagged content and remove policy-violating material.
- If the block is a false positive, adjust the Akto guardrail policy or thresholds.
Example fix
Inspect the Akto dashboard for the violation details and modify the request accordingly.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/akto/akto.py:441 when the library encounters an invalid state.
Common situations: The Akto guardrail detected a policy violation in the request or response.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/d384c4776fafd284.
Report an issue: GitHub.