BerriAI/litellm · error · Exception

Invalid anonymizer response: received None

Error message

Invalid anonymizer response: received None

What it means

Error "Invalid anonymizer response: received None" thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/guardrails/guardrail_hooks/presidio.py:517

    async def anonymize_text(
        self,
        text: str,
        analyze_results: list[PresidioAnalyzeResponseItem] | _PresidioAnonymizeResponse,
        output_parse_pii: bool,
        masked_entity_count: dict[str, int],
        request_data: dict | None = None,
    ) -> str:
        """
        Send analysis results to the Presidio anonymizer endpoint to get redacted text
        """
        try:
            # If there are no detections after filtering, return the original text
            if isinstance(analyze_results, list) and len(analyze_results) == 0:
                return text

            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(

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check that the Presidio anonymizer service is running and reachable at the configured endpoint.
  2. Verify the anonymizer request payload (anonymizers config) matches the Presidio API schema.

When it happens

Trigger: Thrown at litellm/proxy/guardrails/guardrail_hooks/presidio.py:517 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/bc9edd7df872545e. Report an issue: GitHub.