BerriAI/litellm · error · BedrockError
Unexpected mistral completion response
Error message
Unexpected mistral completion response
What it means
Shape guard in the Mistral completion output extractor: the completion JSON has neither a 'choices' array nor any other recognized Mistral output field, so the LLM response text cannot be extracted from the provider payload.
Solutions
- Check the raw Mistral response for an error payload from Bedrock.
- Upgrade litellm if the Mistral response schema changed.
- Retry; if persistent, capture the response and file an issue.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py:109 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/593824907b93ff67.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py:109
"""This function extracts the output text from a bedrock mistral completion.
As a side effect, it updates the finish reason for a model response.
Args:
completion_response: JSON from the completion.
model_response: ModelResponse
Returns:
A string with the response of the LLM
"""
if "choices" in completion_response:
outputText = completion_response["choices"][0]["message"]["content"]
model_response.choices[0].finish_reason = completion_response["choices"][0]["finish_reason"]
elif "outputs" in completion_response:
outputText = completion_response["outputs"][0]["text"]
model_response.choices[0].finish_reason = completion_response["outputs"][0]["stop_reason"]
else:
raise BedrockError(message="Unexpected mistral completion response", status_code=400)
return outputText
View on GitHub (pinned to 77b7c6c40c)