{"record":{"id":"237e40c44efe235e","repo":"BerriAI/litellm","slug":"err-response-text-237e40","errorCode":null,"errorMessage":"err.response.text","messagePattern":"err\\.response\\.text","errorType":"http","errorClass":"BedrockError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/image_edit/handler.py","lineNumber":117,"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\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_edit(\n        self,\n        prepared_request: BedrockImageEditPreparedRequest,\n        timeout: float | httpx.Timeout | None,","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/image_edit/handler.py#L99-L135","documentation":"In the synchronous image_edit path, the httpx response passes through raise_for_status(); a 4xx/5xx becomes httpx.HTTPStatusError which LiteLLM converts to BedrockError carrying the AWS status code and the raw response body as message. The text usually contains Bedrock's modeled error (e.g. ValidationException, AccessDeniedException, ThrottlingException XML/JSON).","triggerScenarios":"Bedrock InvokeModel for image edits returning 400 (malformed body/params), 403 (IAM missing bedrock:InvokeModel), 404 (model not enabled in region), 429 (throttling), or 5xx; triggered on the sync handler after request signing succeeds.","commonSituations":"Model not enabled in the target region's model access settings; missing IAM InvokeModel permission; payload validation failures from bad task params (e.g. bad base64 image); TPS limit exceeded on stability/nova endpoints.","solutions":["Inspect BedrockError.message — it embeds the AWS error type and detail; act on that (enable model access, fix params, add IAM policy).","For 403: grant bedrock:InvokeModel (and foundation-model ARN access) to the signing credentials.","For 404/validation: confirm the model id is enabled in the region and the body params match Nova/Stability schemas.","For 429: retry with backoff or raise your Bedrock quota/TPS limits."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.exceptions import BedrockError\n\ntry:\n    resp = litellm.image_edit(model=model, image=img, prompt=prompt)\nexcept BedrockError as e:\n    if e.status_code == 429:\n        backoff_and_retry()          # throttling\n    elif e.status_code == 403:\n        alert_iam()                  # bedrock:InvokeModel missing\n    elif e.status_code == 404:\n        enable_model_in_region()     # model access\n    else:\n        log_and_surface(e.message)   # body contains AWS error detail","preventionTips":["Enable model access in every target region before deploying.","Grant least-privilege IAM including bedrock:InvokeModel on the model ARNs you call.","Route 429s into an exponential-backoff retry policy."],"tags":["bedrock","image-edit","http-error","iam","throttling"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}