{"record":{"id":"aaf6d428b67dd0b1","repo":"BerriAI/litellm","slug":"str-sync-response-read","errorCode":null,"errorMessage":"{str(sync_response.read())}","messagePattern":"\\{str\\(sync_response\\.read\\(\\)\\)\\}","errorType":"http","errorClass":"SagemakerError","httpStatus":null,"severity":"error","filePath":"litellm/llms/sagemaker/completion/handler.py","lineNumber":346,"sourceCode":"    def make_sync_call(\n        self,\n        api_base: str,\n        headers: dict,\n        data: str,\n        logging_obj,\n        client=None,\n    ):\n        if client is None:\n            client = _get_httpx_client()\n        sync_response: Final = client.post(\n            api_base,\n            headers=headers,\n            data=data,\n            stream=True,\n        )\n\n        if sync_response.status_code != 200:\n            raise SagemakerError(status_code=sync_response.status_code, message=str(sync_response.read()))\n\n        decoder: Final = AWSEventStreamDecoder(model=\"\")\n        return decoder.iter_bytes(sync_response.iter_bytes())\n\n    async def make_async_call(\n        self,\n        api_base: str,\n        headers: dict,\n        data: str,\n        logging_obj,\n        client=None,\n    ):\n        try:\n            if client is None:\n                client = get_async_httpx_client(\n                    llm_provider=litellm.LlmProviders.SAGEMAKER\n                )  # Create a new client if none provided\n            response: Final = await client.post(","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/sagemaker/completion/handler.py#L328-L364","documentation":"Streaming sync call guard: the POST to the SageMaker endpoint returned a status other than 200, so SagemakerError is raised with the status code and the fully-read response body before stream decoding begins.","triggerScenarios":"Triggered when reading the SageMaker completion streaming response body fails or yields an error payload.","commonSituations":"See trigger scenarios.","solutions":["Inspect the raw streamed response content for the error detail.","Verify the endpoint supports streaming and the payload format."],"exampleFix":"# print the raw response bytes to see what the endpoint returned.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}