BerriAI/litellm · error · BadRequestError
- This error occurs when load balancing Responses API…
Error message
{exception_provider} - {message}
This error occurs when load balancing Responses API across deployments with different API keys.
Encrypted content is tied to the organization that created it and cannot be decrypted by other organizations.
Solution: Enable 'encrypted_content_affinity' to route follow-up requests to the correct deployment:
router_settings:
enable_pre_call_checks: true
optional_pre_call_checks:
- encrypted_content_affinity
Learn more: https://docs.litellm.ai/docs/response_api#encrypted-content-affinity-multi-region-load-balancing What it means
Error "{exception_provider} - {message} This error occurs when load balancing Responses API across deployments with different API keys. Encrypted content is tied to the organization that created it and cannot be decrypted by other organizations. Solution: Enable 'encrypted_content_affinity' to route follow-up requests to the correct deployment: router_settings: enable_pre_call_checks: true optional_pre_call_checks: - encrypted_content_affinity Learn more: https://docs.litellm.ai/docs/response_api#encrypted-content-affinity-multi-region-load-balancing" thrown in BerriAI/litellm.
Solutions
- Enable 'encrypted_content_affinity' as an optional pre-call check so follow-up requests route to the deployment that created the encrypted content.
- Alternatively use a single deployment/API key for the whole Responses API conversation.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:344 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/94f0c3502eeca258.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:344
message=f"ContentPolicyViolationError: {exception_provider} - {message}",
llm_provider=custom_llm_provider,
model=model,
response=getattr(original_exception, "response", None),
litellm_debug_info=extra_information,
)
elif "invalid_encrypted_content" in error_str or "could not be verified" in error_str:
helpful_message: Final = (
f"{exception_provider} - {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(
message=helpful_message,
llm_provider=custom_llm_provider,
model=model,
response=getattr(original_exception, "response", None),
litellm_debug_info=extra_information,
body=getattr(original_exception, "body", None),
)
elif "invalid_request_error" in error_str and "Incorrect API key provided" not in error_str:
raise BadRequestError(
message=f"{exception_provider} - {message}",
llm_provider=custom_llm_provider,
model=model,
response=getattr(original_exception, "response", None),
litellm_debug_info=extra_information,
body=getattr(original_exception, "body", None),
)
elif (
"Web server is returning an unknown error" in error_strView on GitHub (pinned to 77b7c6c40c)