BerriAI/litellm · error · ContentPolicyViolationError
content_policy_violation
content_policy_violation
Error message
{provider_message} What it means
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.
Source
Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1927
litellm_debug_info=extra_information,
response=getattr(original_exception, "response", None),
)
elif "DeploymentNotFound" in error_str:
raise NotFoundError(
message=f"AzureException NotFoundError - {message}",
llm_provider="azure",
model=model,
litellm_debug_info=extra_information,
response=getattr(original_exception, "response", None),
)
elif azure_error_code == "content_policy_violation" or ExceptionCheckers.is_azure_content_policy_violation_error(
error_str
):
from litellm.llms.azure.exception_mapping import (
AzureOpenAIExceptionMapping,
)
raise AzureOpenAIExceptionMapping.create_content_policy_violation_error(
message=message,
model=model,
extra_information=extra_information,
original_exception=original_exception,
)
elif azure_error_code == "invalid_encrypted_content" or "could not be verified" in error_str:
helpful_message: Final = (
f"AzureException - {message}\n\n"
"This error occurs when load balancing Responses API across deployments with different API keys.\n"
" Encrypted content is tied to the organization that created it and cannot be decrypted by other organizations.\n\n"
" Solution: Enable 'encrypted_content_affinity' to route follow-up requests to the correct deployment:\n\n"
" router_settings:\n"
" enable_pre_call_checks: true\n"
" optional_pre_call_checks:\n"
" - encrypted_content_affinity\n\n"
" Learn more: https://docs.litellm.ai/docs/response_api#encrypted-content-affinity-multi-region-load-balancing"
)
raise BadRequestError(View on GitHub (pinned to 77b7c6c40c)
Solutions
- Read the provider's message for the root cause and fix the request accordingly.
- Enable verbose logging to capture the full provider error.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:1927 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/e888bd85630f6dcd.
Report an issue: GitHub.