{"record":{"id":"e888bd85630f6dcd","repo":"BerriAI/litellm","slug":"content-policy-violation","errorCode":"content_policy_violation","errorMessage":"{provider_message}","messagePattern":"\\{provider_message\\}","errorType":"exception","errorClass":"ContentPolicyViolationError","httpStatus":400,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":1927,"sourceCode":"            litellm_debug_info=extra_information,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif \"DeploymentNotFound\" in error_str:\n        raise NotFoundError(\n            message=f\"AzureException NotFoundError - {message}\",\n            llm_provider=\"azure\",\n            model=model,\n            litellm_debug_info=extra_information,\n            response=getattr(original_exception, \"response\", None),\n        )\n    elif azure_error_code == \"content_policy_violation\" or ExceptionCheckers.is_azure_content_policy_violation_error(\n        error_str\n    ):\n        from litellm.llms.azure.exception_mapping import (\n            AzureOpenAIExceptionMapping,\n        )\n\n        raise AzureOpenAIExceptionMapping.create_content_policy_violation_error(\n            message=message,\n            model=model,\n            extra_information=extra_information,\n            original_exception=original_exception,\n        )\n    elif azure_error_code == \"invalid_encrypted_content\" or \"could not be verified\" in error_str:\n        helpful_message: Final = (\n            f\"AzureException - {message}\\n\\n\"\n            \"This error occurs when load balancing Responses API across deployments with different API keys.\\n\"\n            \"   Encrypted content is tied to the organization that created it and cannot be decrypted by other organizations.\\n\\n\"\n            \"   Solution: Enable 'encrypted_content_affinity' to route follow-up requests to the correct deployment:\\n\\n\"\n            \"   router_settings:\\n\"\n            \"     enable_pre_call_checks: true\\n\"\n            \"     optional_pre_call_checks:\\n\"\n            \"       - encrypted_content_affinity\\n\\n\"\n            \"   Learn more: https://docs.litellm.ai/docs/response_api#encrypted-content-affinity-multi-region-load-balancing\"\n        )\n        raise BadRequestError(","sourceCodeStart":1909,"sourceCodeEnd":1945,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/exception_mapping_utils.py#L1909-L1945","documentation":"Azure-specific mapping for content policy violations (error code 'content_policy_violation' or ResponsibleAIPolicyViolation): re-raised as litellm ContentPolicyViolationError — the request was refused by Azure's responsible-AI filters. provider_message here is the constructed helpful message.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1927 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the provider's message for the root cause and fix the request accordingly.","Enable verbose logging to capture the full provider error."],"exampleFix":null,"handlingStrategy":"fallback","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"}