{"record":{"id":"cd35775996537c2b","repo":"BerriAI/litellm","slug":"response-text","errorCode":null,"errorMessage":"{response.text}","messagePattern":"\\{response\\.text\\}","errorType":"http","errorClass":"BedrockError","httpStatus":null,"severity":"error","filePath":"litellm/llms/bedrock/chat/invoke_handler.py","lineNumber":187,"sourceCode":"            client = get_async_httpx_client(\n                llm_provider=litellm.LlmProviders.BEDROCK,\n                params=(\n                    {\"ssl_verify\": logging_obj.litellm_params.get(\"ssl_verify\")}\n                    if logging_obj and logging_obj.litellm_params and logging_obj.litellm_params.get(\"ssl_verify\")\n                    else None\n                ),\n            )  # Create a new client if none provided\n\n        response: Final = await client.post(\n            api_base,\n            headers=headers,\n            data=data,\n            stream=not fake_stream,\n            logging_obj=logging_obj,\n        )\n\n        if response.status_code != 200:\n            raise BedrockError(status_code=response.status_code, message=response.text)\n\n        if fake_stream:\n            model_response: Final[ModelResponse] = litellm.AmazonConverseConfig()._transform_response(\n                model=model,\n                response=response,\n                model_response=litellm.ModelResponse(),\n                stream=True,\n                logging_obj=logging_obj,\n                optional_params={},\n                api_key=\"\",\n                data=data,\n                messages=messages,\n                encoding=litellm.encoding,\n            )\n            completion_stream: Any = MockResponseIterator(model_response=model_response, json_mode=json_mode)\n        elif bedrock_invoke_provider == \"anthropic\":\n            decoder: AWSEventStreamDecoder = AmazonAnthropicClaudeStreamDecoder(\n                model=model,","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/chat/invoke_handler.py#L169-L205","documentation":"First gate in the shared async invoke handler: any non-200 status on the POST raises BedrockError carrying that status and the raw body text. It covers the fake-stream and non-streaming paths before any parsing is attempted, so the message is AWS's own error document.","triggerScenarios":"403 access denied (credentials lack bedrock:InvokeModel), 404 unknown model id, 400 for parameters the model rejects (e.g. topK/topP combinations), 429 throttling, and 5xx service errors on the invoke-model endpoint.","commonSituations":"Model ids missing the version suffix (:0); inference params not supported by a specific Bedrock model; models not available in the configured region; throttling during traffic spikes.","solutions":["Read e.status_code and the message in e.message for the AWS-stated reason","Validate optional_params against the specific model's supported inference configuration","Verify model id, region, and account model access; check IAM permissions","Retry on 429/5xx via num_retries or Router fallback deployments"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    resp = await litellm.acompletion(model=\"bedrock/...\", messages=msgs)\nexcept BedrockError as e:\n    if e.status_code == 400:\n        raise ValueError(f\"Model rejected inference params: {e.message}\") from e\n    if e.status_code in (429, 500, 503):\n        await asyncio.sleep(2)\n        resp = await litellm.acompletion(model=\"bedrock/...\", messages=msgs)\n    else:\n        raise","preventionTips":["Validate per-model supported params (some Bedrock models reject topK/topP combos)","Verify model ids include version suffixes","Set num_retries for throttling resilience"],"tags":["bedrock","invoke","http-status","aws"],"backgroundTag":"http-error-response","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}