{"record":{"id":"593824907b93ff67","repo":"BerriAI/litellm","slug":"unexpected-mistral-completion-response","errorCode":null,"errorMessage":"Unexpected mistral completion response","messagePattern":"Unexpected mistral completion response","errorType":"exception","errorClass":"BedrockError","httpStatus":400,"severity":"error","filePath":"litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py","lineNumber":109,"sourceCode":"        \"\"\"This function extracts the output text from a bedrock mistral completion.\n        As a side effect, it updates the finish reason for a model response.\n\n        Args:\n            completion_response: JSON from the completion.\n            model_response: ModelResponse\n\n        Returns:\n            A string with the response of the LLM\n\n        \"\"\"\n        if \"choices\" in completion_response:\n            outputText = completion_response[\"choices\"][0][\"message\"][\"content\"]\n            model_response.choices[0].finish_reason = completion_response[\"choices\"][0][\"finish_reason\"]\n        elif \"outputs\" in completion_response:\n            outputText = completion_response[\"outputs\"][0][\"text\"]\n            model_response.choices[0].finish_reason = completion_response[\"outputs\"][0][\"stop_reason\"]\n        else:\n            raise BedrockError(message=\"Unexpected mistral completion response\", status_code=400)\n\n        return outputText\n","sourceCodeStart":91,"sourceCodeEnd":112,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py#L91-L112","documentation":"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.","triggerScenarios":"Thrown at litellm/llms/bedrock/chat/invoke_transformations/amazon_mistral_transformation.py:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"try-catch","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-23T08:17:48.524Z"}