BerriAI/litellm · error · BedrockError
Error converting to valid response block=
Error message
Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues What it means
After a successful HTTP 200, the Bedrock Converse response JSON is validated into the typed ConverseResponseBlock model. Any mismatch — missing required fields, wrong types, or new AWS fields the installed LiteLLM schema does not know — raises BedrockError 422 with a message asking you to file an issue. The network call succeeded; this is a schema mismatch between AWS output and LiteLLM's response model.
Solutions
- Upgrade LiteLLM to the latest release — response-block models are updated in patch releases as Bedrock adds fields
- Capture response.text with a post-call logging hook to identify the offending field
- If it persists on the latest version, file the issue at https://github.com/BerriAI/litellm/issues with the redacted payload
- As a stopgap, pin calls to a Bedrock region/model combination that still returns the older schema
Defensive patterns
Strategy: try-catch
Try / catch
try:
resp = litellm.completion(model="bedrock/...", messages=msgs)
except BedrockError as e:
if e.status_code == 422 and "Error converting to valid response block" in str(e):
logger.error("Bedrock schema drift — update litellm; payload: %s", captured_response_text)
raise DependencyOutdated("pip install -U litellm") from e
raise Prevention
- Keep LiteLLM on recent releases when using newest Bedrock features
- Subscribe to LiteLLM release notes for ConverseResponseBlock schema updates
- Capture response bodies with logging hooks in staging to detect drift before prod
When it happens
Trigger: AWS ships a response containing fields, enum values, or block types absent from your LiteLLM version's ConverseResponseBlock; an error body reaching the success parser; a response mutated by a proxy or cross-region inference endpoint with a nonstandard envelope.
Common situations: Running an older LiteLLM against a newly updated Bedrock API; beta features (guardrail traces, performance configs, new tool result shapes) returning extra fields; the morning after an AWS rollout with a pinned litellm version.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- BedrockException
- {err.response.text}
- Error processing response
- messages must be a list
- messages parameter is required for Converse input
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/87371b3940e26f33.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/chat/converse_transformation.py:2157
data: dict | str,
messages: list,
encoding,
) -> ModelResponse:
## LOGGING
if logging_obj is not None:
logging_obj.post_call(
input=messages,
api_key=api_key,
original_response=response.text,
additional_args={"complete_input_dict": data},
)
json_mode: Final[bool | None] = optional_params.get("json_mode", None)
## RESPONSE OBJECT
try:
completion_response: Final = ConverseResponseBlock(**response.json())
except Exception as e:
raise BedrockError(
message=f"Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues",
status_code=422,
)
"""
Bedrock Response Object has optional message block
completion_response["output"].get("message", None)
A message block looks like this (Example 1):
"output": {
"message": {
"role": "assistant",
"content": [
{
"text": "Is there anything else you'd like to talk about? Perhaps I can help with some economic questions or provide some information about economic concepts?"
}
]View on GitHub (pinned to 77b7c6c40c)