{"record":{"id":"87371b3940e26f33","repo":"BerriAI/litellm","slug":"error-converting-to-valid-response-block-e-file","errorCode":null,"errorMessage":"Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues","messagePattern":"Error converting to valid response block=(.+?)\\. File an issue if litellm error - https://github\\.com/BerriAI/litellm/issues","errorType":"exception","errorClass":"BedrockError","httpStatus":422,"severity":"error","filePath":"litellm/llms/bedrock/chat/converse_transformation.py","lineNumber":2100,"sourceCode":"        data: dict | str,\n        messages: list,\n        encoding,\n    ) -> ModelResponse:\n        ## LOGGING\n        if logging_obj is not None:\n            logging_obj.post_call(\n                input=messages,\n                api_key=api_key,\n                original_response=response.text,\n                additional_args={\"complete_input_dict\": data},\n            )\n\n        json_mode: Final[bool | None] = optional_params.get(\"json_mode\", None)\n        ## RESPONSE OBJECT\n        try:\n            completion_response: Final = ConverseResponseBlock(**response.json())\n        except Exception as e:\n            raise BedrockError(\n                message=f\"Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues\",\n                status_code=422,\n            )\n\n        \"\"\"\n        Bedrock Response Object has optional message block\n\n        completion_response[\"output\"].get(\"message\", None)\n\n        A message block looks like this (Example 1):\n        \"output\": {\n            \"message\": {\n                \"role\": \"assistant\",\n                \"content\": [\n                    {\n                        \"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?\"\n                    }\n                ]","sourceCodeStart":2082,"sourceCodeEnd":2118,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/chat/converse_transformation.py#L2082-L2118","documentation":"Error \"Error converting to valid response block={e}. File an issue if litellm error - https://github.com/BerriAI/litellm/issues\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/bedrock/chat/converse_transformation.py:2100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["File a LiteLLM issue with the failing response block; check the Bedrock response shape."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}