BerriAI/litellm · error · BedrockError
Error parsing response
Error message
Error parsing response: {raw_response.text}, error: {e} What it means
Response-parsing failure in the TwelveLabs Pegasus response transformer: raw_response.json() raised, so the body is not valid JSON and the 'message'/'finishReason' fields cannot be extracted into a ModelResponse.
Solutions
- Inspect raw_response.text for a Bedrock-side error message.
- Verify the TwelveLabs Pegasus model id and request format.
- Retry the request; if persistent, file an issue with the raw response.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/bedrock/chat/invoke_transformations/amazon_twelvelabs_pegasus_transformation.py:210 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/4f703dec48e82592.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/chat/invoke_transformations/amazon_twelvelabs_pegasus_transformation.py:210
api_key: str | None = None,
json_mode: bool | None = None,
) -> ModelResponse:
"""
Transform TwelveLabs Pegasus response to LiteLLM format.
TwelveLabs response format:
{
"message": "...",
"finishReason": "stop" | "length"
}
LiteLLM format:
ModelResponse with choices[0].message.content and finish_reason
"""
try:
completion_response: Final = raw_response.json()
except Exception as e:
raise BedrockError(
message=f"Error parsing response: {raw_response.text}, error: {e}",
status_code=raw_response.status_code,
)
verbose_logger.debug(
"twelvelabs pegasus response: %s",
json.dumps(completion_response, indent=4, default=str),
)
# Extract message content
message_content: Final = completion_response.get("message", "")
# Extract finish reason and map to LiteLLM format
finish_reason_raw: Final = completion_response.get("finishReason", "stop")
finish_reason: Final = map_finish_reason(finish_reason_raw)
# Set the response content
try:View on GitHub (pinned to 77b7c6c40c)