{"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/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/image_generation/image_handler.py#L104-L140","documentation":"The synchronous Bedrock image-generation HTTP call returned a non-2xx status; response.raise_for_status() raised httpx.HTTPStatusError and litellm re-raised it as BedrockError with the upstream status code and raw response body (err.response.text). The body is Bedrock's own error JSON (e.g. validation errors, throttling, model access denied).","triggerScenarios":"POST to bedrock-runtime/model/invoke with invalid payload (400), missing model access (403/404 AccessDeniedException), throttling (429 TooManyRequestsException), or wrong region/endpoint (403).","commonSituations":"Model ID typos (stability.stable-image-core vs ...:0), no model subscription in the AWS account, IAM credentials lacking bedrock:InvokeModel, expired SigV4 signature due to clock skew, hitting account TPS limits.","solutions":["Read the message body: it contains the AWS error code and message (e.g. 'ModelStreamErrorException', 'ValidationException').","Verify the model ID exists and your account has access in the target region (Bedrock console > Model access).","Check IAM permissions include bedrock:InvokeModel and that credentials/region env vars are set.","For 429, retry with exponential backoff or reduce request rate.","Sync system clock if you suspect SigV4 'Signature expired' errors."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.exceptions import BedrockError\n\nfor attempt in range(5):\n    try:\n        return litellm.image_generation(model=model, prompt=p)\n    except BedrockError as e:\n        if e.status_code == 429 and attempt < 4:\n            time.sleep(2 ** attempt + random.random())\n            continue\n        raise","preventionTips":["Enable Bedrock model access and verify IAM bedrock:InvokeModel before shipping.","Log err.response.text verbatim — it contains the exact AWS error code for triage.","Implement retry-with-backoff for 429/5xx only, never for 400/403."],"tags":["bedrock","http-status","image-generation","aws","api-error"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}