{"record":{"id":"7680e617d1f00a9d","repo":"BerriAI/litellm","slug":"err-response-text","errorCode":null,"errorMessage":"{err.response.text}","messagePattern":"\\{err\\.response\\.text\\}","errorType":"http","errorClass":"BedrockError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/embed/embedding.py","lineNumber":115,"sourceCode":"        api_base: str,\n        headers: dict,\n        data: dict,\n    ) -> dict:\n        if client is None or not isinstance(client, HTTPHandler):\n            _params: Final = {}\n            if timeout is not None:\n                if isinstance(timeout, float) or isinstance(timeout, int):\n                    timeout = httpx.Timeout(timeout)\n                _params[\"timeout\"] = timeout\n            client = _get_httpx_client(_params)\n        else:\n            client = client\n        try:\n            response: Final = client.post(url=api_base, headers=headers, data=json.dumps(data))\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        return response.json()\n\n    async def _make_async_call(\n        self,\n        client: AsyncHTTPHandler | None,\n        timeout: float | httpx.Timeout | None,\n        api_base: str,\n        headers: dict,\n        data: dict,\n    ) -> dict:\n        if client is None or not isinstance(client, AsyncHTTPHandler):\n            _params: Final = {}\n            if timeout is not None:\n                if isinstance(timeout, float) or isinstance(timeout, int):\n                    timeout = httpx.Timeout(timeout)","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/bedrock/embed/embedding.py#L97-L133","documentation":"Raised when the synchronous Bedrock embedding HTTP call returns a non-2xx status (response.raise_for_status() throws httpx.HTTPStatusError). LiteLLM wraps it into BedrockError carrying the status code and the AWS response body as the message. Note the sibling handler maps timeouts to BedrockError 408.","triggerScenarios":"Invalid modelId for the region (404), access denied to bedrock:InvokeModel (403), payload validation errors (400, e.g. oversized inputText), or throttling (429) during litellm.embedding on bedrock models.","commonSituations":"Model access not enabled in the AWS account/region, IAM policy missing embedding-model permissions, inputs exceeding Titan/Nova per-request token limits, or rate limits under batch load.","solutions":["Read e.status_code and e.message — the AWS body states the precise violation","403/404: verify modelId, region, and IAM bedrock:InvokeModel permissions","400: shrink or chunk input texts to the model's size limit","429: backoff and retry; consider batching controls in LiteLLM config"],"exampleFix":"# before\ntry:\n    resp = litellm.embedding(model='bedrock/amazon.titan-embed-text-v2:0', input=['text'])\nexcept Exception:\n    raise\n\n# after\nfrom litellm.llms.bedrock.common_utils import BedrockError\ntry:\n    resp = litellm.embedding(model='bedrock/amazon.titan-embed-text-v2:0', input=['text'])\nexcept BedrockError as e:\n    if e.status_code == 429:\n        time.sleep(2 ** attempt); retry()\n    else:\n        raise","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from litellm.llms.bedrock.common_utils import BedrockError\n\nfor attempt in range(5):\n    try:\n        resp = litellm.embedding(model=\"bedrock/amazon.titan-embed-text-v2:0\", input=texts)\n        break\n    except BedrockError as e:\n        if e.status_code == 429 and attempt < 4:\n            time.sleep(2 ** attempt)\n            continue\n        if e.status_code == 400 and \"inputText\" in e.message:\n            texts = [chunk_texts(t, 8192) for t in texts]; continue\n        raise","preventionTips":["Chunk input text to the embedding model's token limit before sending","Confirm model access is enabled in the target AWS region","Wrap bedrock embedding calls with exponential-backoff on 429/5xx via litellm's retries setting"],"tags":["bedrock","embedding","aws","http"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}