{"record":{"id":"7402286e8ad328a4","repo":"BerriAI/litellm","slug":"sagemaker-event-stream-shape-could-not-be-loaded-f","errorCode":null,"errorMessage":"SageMaker event-stream shape could not be loaded from botocore. Ensure botocore is correctly installed.","messagePattern":"SageMaker event-stream shape could not be loaded from botocore\\. Ensure botocore is correctly installed\\.","errorType":"exception","errorClass":"SagemakerError","httpStatus":500,"severity":"error","filePath":"litellm/llms/sagemaker/common_utils.py","lineNumber":196,"sourceCode":"        # Handle any remaining data after the iterator is exhausted\n        if accumulated_json:\n            try:\n                _data = json.loads(accumulated_json)\n                if self.is_messages_api:\n                    yield self._chunk_parser_messages_api(chunk_data=_data)\n                else:\n                    yield self._chunk_parser(chunk_data=_data)\n            except json.JSONDecodeError:\n                # Handle or log any unparseable data at the end\n                verbose_logger.error(\"Warning: Unparseable JSON data remained: %s\", accumulated_json)\n                yield None\n            except Exception as e:\n                verbose_logger.error(\"Final error parsing accumulated JSON: %s\", e)\n\n    def _parse_message_from_event(self, event) -> str | None:\n        response_stream_shape: Final = get_sagemaker_response_stream_shape()\n        if response_stream_shape is None:\n            raise SagemakerError(\n                status_code=500,\n                message=(\n                    \"SageMaker event-stream shape could not be loaded from botocore. \"\n                    \"Ensure botocore is correctly installed.\"\n                ),\n            )\n        response_dict: Final = event.to_response_dict()\n        parsed_response: Final = self.parser.parse(response_dict, response_stream_shape)\n\n        if response_dict[\"status_code\"] != 200:\n            raise ValueError(f\"Bad response code, expected 200: {response_dict}\")\n\n        if \"chunk\" in parsed_response:\n            chunk = parsed_response.get(\"chunk\")\n            if not chunk:\n                return None\n            return chunk.get(\"bytes\").decode()\n        else:","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/sagemaker/common_utils.py#L178-L214","documentation":"Event-stream decoder guard: get_sagemaker_response_stream_shape() returned None because botocore could not supply the SageMaker response stream shape, so events cannot be decoded; raised with status 500.","triggerScenarios":"Triggered when the SageMaker event-stream shape cannot be loaded from botocore, indicating a broken botocore installation.","commonSituations":"See trigger scenarios.","solutions":["Reinstall or upgrade botocore so the event-stream shape is available.","Ensure boto3/botocore versions are compatible."],"exampleFix":"pip install -U boto3 botocore","handlingStrategy":"validation","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"}