{"record":{"id":"9ca71f70bcff932a","repo":"BerriAI/litellm","slug":"err-response-text-9ca71f","errorCode":null,"errorMessage":"err.response.text","messagePattern":"err\\.response\\.text","errorType":"http","errorClass":"BedrockError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/image_generation/image_handler.py","lineNumber":122,"sourceCode":"                model=model,\n                logging_obj=logging_obj,\n                prompt=prompt,\n                model_response=model_response,\n                client=(client if client is not None and isinstance(client, AsyncHTTPHandler) else None),\n            )\n\n        if client is None or not isinstance(client, HTTPHandler):\n            client = _get_httpx_client()\n        try:\n            response: Final = client.post(\n                url=prepared_request.endpoint_url,\n                headers=prepared_request.prepped.headers,\n                data=prepared_request.body,\n            )\n            response.raise_for_status()\n        except httpx.HTTPStatusError as err:\n            error_code: Final = err.response.status_code\n            raise BedrockError(status_code=error_code, message=err.response.text)\n        except httpx.TimeoutException:\n            raise BedrockError(status_code=408, message=\"Timeout error occurred.\")\n        ### FORMAT RESPONSE TO OPENAI FORMAT ###\n        model_response = self._transform_response_dict_to_openai_response(\n            model_response=model_response,\n            model=model,\n            logging_obj=logging_obj,\n            prompt=prompt,\n            response=response,\n            data=prepared_request.data,\n        )\n        return model_response\n\n    async def async_image_generation(\n        self,\n        prepared_request: BedrockImagePreparedRequest,\n        timeout: float | httpx.Timeout | None,\n        model: str,","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/image_generation/image_handler.py#L104-L140","documentation":"Raised from BedrockImageGeneration.image_generation when the synchronous POST to the Bedrock runtime endpoint returns a non-2xx status. response.raise_for_status() throws httpx.HTTPStatusError and LiteLLM re-raises it as BedrockError carrying the upstream status code and the raw AWS response body as the message. It is a pass-through of AWS's error JSON (validation, throttling, access denied, model not found, etc.).","triggerScenarios":"litellm.image() against a Bedrock image model where AWS returns 4xx/5xx: invalid imageGenerationConfig values, model not enabled in the region, ThrottlingException (429), missing bedrock:InvokeModel permission, or a malformed model id.","commonSituations":"Wrong region/model-id combinations, IAM roles without Bedrock invoke permissions, throttling under load, oversized images or invalid width/height/quality values in optional_params.","solutions":["Read the message field: it is the raw AWS error body and names the concrete cause (validation, access, throttling)","Verify the model id exists and is enabled in aws_region_name and that credentials have bedrock:InvokeModel","For 429/5xx statuses retry with exponential backoff"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.bedrock.common_utils import BedrockError\n\ntry:\n    resp = litellm.image(model=model, prompt=prompt)\nexcept BedrockError as e:\n    if e.status_code in (429, 500, 502, 503):\n        backoff_and_retry()  # transient upstream conditions\n    else:\n        handle_permanent(e.status_code, e.message)  # e.message is the raw AWS error body","preventionTips":["Branch on status_code: 4xx (except 429) is a config/permission bug you must fix, 5xx/429 is retryable","Validate width/height/quality against the model's documented ranges before calling","Ensure the IAM identity has bedrock:InvokeModel on the model in the target region"],"tags":["bedrock","image-generation","http-error","upstream-error"],"backgroundTag":"upstream-http-error","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}