{"record":{"id":"05743e0c07e65684","repo":"BerriAI/litellm","slug":"blocked-entity-detected-entity-type-by-guardrai","errorCode":null,"errorMessage":"Blocked entity detected: {entity_type} by Guardrail: {guardrail_name}. This entity is not allowed to be used in this request.","messagePattern":"Blocked entity detected: (.+?) by Guardrail: (.+?)\\. This entity is not allowed to be used in this request\\.","errorType":"exception","errorClass":"BlockedPiiEntityError","httpStatus":400,"severity":"error","filePath":"litellm/proxy/guardrails/guardrail_hooks/presidio.py","lineNumber":595,"sourceCode":"    ):\n        \"\"\"\n        Raise an exception if blocked entities are detected\n        \"\"\"\n        if self.pii_entities_config is None:\n            return\n\n        if isinstance(analyze_results, dict):\n            # if mock testing is enabled, analyze_results is a dict\n            # we don't need to raise an exception in this case\n            return\n\n        for result in analyze_results:\n            entity_type = result.get(\"entity_type\")\n\n            if entity_type:\n                # Check if entity_type is in config (supports both enum and string)\n                if entity_type in self.pii_entities_config and self.pii_entities_config[entity_type] == PiiAction.BLOCK:\n                    raise BlockedPiiEntityError(\n                        entity_type=entity_type,\n                        guardrail_name=self.guardrail_name,\n                    )\n\n    async def check_pii(\n        self,\n        text: str,\n        output_parse_pii: bool,\n        presidio_config: PresidioPerRequestConfig | None,\n        request_data: dict,\n    ) -> str:\n        \"\"\"\n        Calls Presidio Analyze + Anonymize endpoints for PII Analysis + Masking\n        \"\"\"\n        start_time: Final = datetime.now()\n        analyze_results: list[PresidioAnalyzeResponseItem] | _PresidioAnonymizeResponse | None = None\n        status: GuardrailStatus = \"success\"\n        masked_entity_count: Final[dict[str, int]] = {}","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/guardrails/guardrail_hooks/presidio.py#L577-L613","documentation":"Error \"Blocked entity detected: {entity_type} by Guardrail: {guardrail_name}. This entity is not allowed to be used in this request.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/guardrails/guardrail_hooks/presidio.py:595 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the blocked PII entity from the request, or add the entity type to the allowed list for this guardrail.","Adjust the Presidio blocked entities configuration if the entity should be permitted."],"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"}