{"record":{"id":"a03ac9c3ded2b66d","repo":"BerriAI/litellm","slug":"error-processing-raw-response-text-received-err","errorCode":null,"errorMessage":"Error processing={raw_response.text}, Received error={e}","messagePattern":"Error processing=(.+?), Received error=(.+?)","errorType":"exception","errorClass":"BedrockError","httpStatus":422,"severity":"error","filePath":"litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py","lineNumber":362,"sourceCode":"                    logging_obj=logging_obj,\n                    request_data=request_data,\n                    messages=messages,\n                    optional_params=optional_params,\n                    litellm_params=litellm_params,\n                    encoding=encoding,\n                    api_key=api_key,\n                    json_mode=json_mode,\n                )\n            elif provider == \"ai21\":\n                outputText = completion_response.get(\"completions\")[0].get(\"data\").get(\"text\")\n            elif provider == \"meta\" or provider == \"llama\" or provider == \"deepseek_r1\":\n                outputText = completion_response[\"generation\"]\n            elif provider == \"mistral\":\n                outputText = litellm.AmazonMistralConfig.get_outputText(completion_response, model_response)\n            else:  # amazon titan\n                outputText = completion_response.get(\"results\")[0].get(\"outputText\")\n        except Exception as e:\n            raise BedrockError(\n                message=f\"Error processing={raw_response.text}, Received error={e}\",\n                status_code=422,\n            )\n\n        try:\n            if (\n                outputText is not None\n                and len(outputText) > 0\n                and hasattr(model_response.choices[0], \"message\")\n                and getattr(model_response.choices[0].message, \"tool_calls\", None) is None\n            ):\n                model_response.choices[0].message.content = outputText\n            elif (\n                hasattr(model_response.choices[0], \"message\")\n                and getattr(model_response.choices[0].message, \"tool_calls\", None) is not None\n            ):\n                pass\n            else:","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py#L344-L380","documentation":"Response-processing failure in the invoke response transformer: extracting the output text from the parsed completion_response raised (unexpected provider payload shape or missing keys), and the handler wraps the raw response text with the exception.","triggerScenarios":"Thrown at litellm/llms/bedrock/chat/invoke_transformations/base_invoke_transformation.py:362 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect raw_response.text for the provider's error details.","Verify request parameters against the model's expected schema.","Retry; if persistent, capture the response and file an issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}