BerriAI/litellm · error · BedrockError

Error converting to valid response block={e}. File an issue

Error message

Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues

What it means

Error "Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues" thrown in BerriAI/litellm.

Source

Thrown at litellm/llms/bedrock/chat/converse_transformation.py:2100

        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 6c2dcb801b)

Solutions

  1. File a LiteLLM issue with the failing response block; check the Bedrock response shape.

When it happens

Trigger: Thrown at litellm/llms/bedrock/chat/converse_transformation.py:2100 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/87371b3940e26f33. Report an issue: GitHub.