vercel/ai · error
Unsupported content type in assistant message: ${part.type}
Error message
Unsupported content type in assistant message: ${part.type} What it means
convertToMistralChatMessages switches over assistant message part types and only supports text, tool-call, and reasoning parts. An unrecognized assistant part type falls into the default branch and throws a plain Error naming the unsupported type.
Source
Thrown at packages/mistral/src/convert-to-mistral-chat-messages.ts:143
type: 'function',
function: {
name: part.toolName,
arguments: JSON.stringify(part.input),
},
});
break;
}
case 'reasoning': {
hasReasoning = true;
contentParts.push({
type: 'thinking',
thinking: [{ type: 'text', text: part.text }],
closed: true,
});
break;
}
default: {
throw new Error(
`Unsupported content type in assistant message: ${part.type}`,
);
}
}
}
messages.push({
role: 'assistant',
content: hasReasoning ? contentParts : text,
prefix: isLastMessage ? true : undefined,
tool_calls: toolCalls.length > 0 ? toolCalls : undefined,
});
break;
}
case 'tool': {
for (const toolResponse of content) {
if (toolResponse.type === 'tool-approval-response') {View on GitHub (pinned to 69428b1f8b)
Solutions
- Remove or convert unsupported assistant parts before sending to Mistral.
- Map unsupported parts to plain text parts where content allows.
- Update @ai-sdk/mistral to the latest version for broader part support.
- Strip provider-specific parts when persisting/replaying conversation history.
Example fix
// before: assistant message with unsupported part
{ role: 'assistant', content: [{ type: 'redacted-reasoning', ... }] }
// after: keep only supported parts
{ role: 'assistant', content: [{ type: 'text', text: 'assistant reply' }] } Defensive patterns
Strategy: type-guard
Validate before calling
const supportedAssistantTypes = new Set(['text', 'tool-call', 'reasoning']);
function hasUnsupportedAssistantParts(prompt: { messages: { role: string; content: { type: string }[] }[] }[]): boolean {
return prompt.some(m => m.role === 'assistant' && m.content.some(p => !supportedAssistantTypes.has(p.type)));
} Type guard
function isSupportedAssistantPart(part: { type: string }): boolean {
return ['text', 'tool-call', 'reasoning'].includes(part.type);
} Try / catch
try {
await generateText({ model: mistral(modelId), prompt });
} catch (error) {
if (error instanceof Error && error.message.startsWith('Unsupported content type in assistant message')) {
// strip/convert the offending part type and retry
} else {
throw error;
}
} Prevention
- Sanitize multi-provider conversation histories before replaying on Mistral.
- Keep `ai` core and `@ai-sdk/mistral` versions in sync.
- Map new part types to supported equivalents in your prompt builder.
When it happens
Trigger: Passing a prompt whose assistant message contains a part type the Mistral converter doesn't handle (e.g. a newer part kind introduced in the spec but not yet mapped for Mistral) via generateText/streamText.
Common situations: Replaying multi-provider conversation histories (with provider-specific parts) against Mistral; SDK version skew where prompts contain part types added after Mistral support was written.
Related errors
- file part data type ${part.data.type}
- file parts with provider references
- text file parts
- Unsupported role: ${_exhaustiveCheck}
- Only images and PDF file parts are supported
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/0f694fbdd87004d4.
Report an issue: GitHub.