BerriAI/litellm · error · Exception
Presidio PII anonymization failed: {type(e).__name__}
Error message
Presidio PII anonymization failed: {type(e).__name__} What it means
Error "Presidio PII anonymization failed: {type(e).__name__}" thrown in BerriAI/litellm.
Source
Thrown at litellm/proxy/guardrails/guardrail_hooks/presidio.py:533
redacted_text: Final = await self._post_presidio_anonymize(text, analyze_results)
if redacted_text is None:
raise Exception("Invalid anonymizer response: received None")
verbose_proxy_logger.debug("redacted_text: %s", redacted_text)
if not output_parse_pii:
return self._finalize_presidio_anonymize_simple(redacted_text, masked_entity_count)
return self._finalize_presidio_anonymize_numbered_tokens(
text, analyze_results, request_data, masked_entity_count
)
except Exception as e:
# Sanitize exception to avoid leaking the original text (which may
# contain API keys or other secrets) in error responses.
error_str: Final = str(e)
if "Invalid anonymizer response" in error_str or "Presidio anonymizer returned" in error_str:
raise
raise Exception(f"Presidio PII anonymization failed: {type(e).__name__}") from e
def filter_analyze_results_by_score(
self, analyze_results: list[PresidioAnalyzeResponseItem] | _PresidioAnonymizeResponse
) -> list[PresidioAnalyzeResponseItem] | _PresidioAnonymizeResponse:
"""
Drop detections that fall below configured per-entity score thresholds
or match an entity type in the deny list.
"""
if not self.presidio_score_thresholds and not self.presidio_entities_deny_list:
return analyze_results
if not isinstance(analyze_results, list):
return analyze_results
filtered_results: Final[list[PresidioAnalyzeResponseItem]] = []
deny_list_strings: Final = [getattr(x, "value", str(x)) for x in self.presidio_entities_deny_list]
for item in analyze_results:
entity_type = item.get("entity_type")View on GitHub (pinned to 77b7c6c40c)
Solutions
- Check the proxy logs for the underlying Presidio exception.
- Verify the Presidio analyzer/anonymizer endpoints and language configuration.
- Confirm the input text encoding and size are within Presidio limits.
When it happens
Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/presidio.py:533 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/464697803fd0e1a1.
Report an issue: GitHub.