BerriAI/litellm · error · SagemakerError
{sync_response.text}
Error message
{sync_response.text} What it means
The synchronous SageMaker completion HTTP call returned a non-200 status; the handler raises SagemakerError carrying the raw response body so callers see the underlying endpoint error instead of a bare httpx status.
Source
Thrown at litellm/llms/sagemaker/completion/handler.py:295
api_key="",
additional_args={
"complete_input_dict": _data,
"api_base": prepared_request.url,
"headers": prepared_request.headers,
},
)
# make sync httpx post request here
try:
sync_response: Final = sync_handler.post(
url=prepared_request.url,
headers=prepared_request.headers,
data=prepared_request.body,
timeout=timeout,
)
if sync_response.status_code != 200:
raise SagemakerError(
status_code=sync_response.status_code,
message=sync_response.text,
)
except Exception as e:
## LOGGING
logging_obj.post_call(
input=[],
api_key="",
original_response=str(e),
additional_args={"complete_input_dict": _data},
)
raise e
except Exception as e:
verbose_logger.error("Sagemaker error %s", str(e))
status_code: Final = getattr(e, "response", {}).get("ResponseMetadata", {}).get("HTTPStatusCode", 500)
error_message = getattr(e, "response", {}).get("Error", {}).get("Message", str(e))
if "Inference Component Name header is required" in error_message:
error_message += "\n pass in via `litellm.completion(..., model_id={InferenceComponentName})`"View on GitHub (pinned to 77b7c6c40c)
Solutions
- Inspect sync_response.text for the endpoint's error message.
- Verify the SageMaker endpoint is InService and the input schema matches.
Example fix
# log the response body from the raised error.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Triggered when the synchronous SageMaker completion call returns an HTTP error; sync_response.text is surfaced.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/665a177bb3eb7a5a.
Report an issue: GitHub.