{"record":{"id":"9cd9cf3e5d13c4ed","repo":"BerriAI/litellm","slug":"prepared-request-body-is-empty","errorCode":null,"errorMessage":"Prepared request body is empty","messagePattern":"Prepared request body is empty","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/sagemaker/completion/handler.py","lineNumber":433,"sourceCode":"            litellm_params=litellm_params,\n            headers=headers,\n        )\n        asyncified_prepare_request: Final = asyncify(self._prepare_request)\n        prepared_request_args: Final = {\n            \"model\": model,\n            \"data\": data,\n            \"optional_params\": optional_params,\n            \"litellm_params\": litellm_params,\n            \"credentials\": credentials,\n            \"aws_region_name\": aws_region_name,\n            \"messages\": messages,\n        }\n        prepared_request: Final = await asyncified_prepare_request(**prepared_request_args)\n        if model_id is not None:  # Fixes https://github.com/BerriAI/litellm/issues/8889\n            prepared_request.headers.update({\"X-Amzn-SageMaker-Inference-Component\": model_id})\n\n        if not prepared_request.body:\n            raise ValueError(\"Prepared request body is empty\")\n\n        stream_logging_obj: Final[LiteLLMLoggingObj] = logging_obj\n        completion_stream: Final = await self.make_async_call(\n            api_base=prepared_request.url,\n            headers=prepared_request.headers,\n            data=cast(str, prepared_request.body),\n            logging_obj=stream_logging_obj,\n        )\n        streaming_response: Final = CustomStreamWrapper(\n            completion_stream=completion_stream,\n            model=model,\n            custom_llm_provider=\"sagemaker\",\n            logging_obj=stream_logging_obj,\n        )\n\n        # LOGGING\n        logging_obj.post_call(\n            input=[],","sourceCodeStart":415,"sourceCodeEnd":451,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/sagemaker/completion/handler.py#L415-L451","documentation":"Post-preparation sentinel guard: after asyncify(self._prepare_request) builds the request, the resulting prepared_request.body is empty, meaning no JSON payload was produced for the SageMaker call, so the handler aborts before sending.","triggerScenarios":"Triggered when the prepared SageMaker completion request body is empty.","commonSituations":"See trigger scenarios.","solutions":["Ensure the request includes a non-empty prompt/messages so the prepared body is not empty.","Check input transformation for the SageMaker model type."],"exampleFix":"# verify messages/prompt is passed and non-empty.","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-14T05:17:10.506Z"}