{"record":{"id":"0f694fbdd87004d4","repo":"vercel/ai","slug":"unsupported-content-type-in-assistant-message-p","errorCode":null,"errorMessage":"Unsupported content type in assistant message: ${part.type}","messagePattern":"Unsupported content type in assistant message: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mistral/src/convert-to-mistral-chat-messages.ts","lineNumber":143,"sourceCode":"                type: 'function',\n                function: {\n                  name: part.toolName,\n                  arguments: JSON.stringify(part.input),\n                },\n              });\n              break;\n            }\n            case 'reasoning': {\n              hasReasoning = true;\n              contentParts.push({\n                type: 'thinking',\n                thinking: [{ type: 'text', text: part.text }],\n                closed: true,\n              });\n              break;\n            }\n            default: {\n              throw new Error(\n                `Unsupported content type in assistant message: ${part.type}`,\n              );\n            }\n          }\n        }\n\n        messages.push({\n          role: 'assistant',\n          content: hasReasoning ? contentParts : text,\n          prefix: isLastMessage ? true : undefined,\n          tool_calls: toolCalls.length > 0 ? toolCalls : undefined,\n        });\n\n        break;\n      }\n      case 'tool': {\n        for (const toolResponse of content) {\n          if (toolResponse.type === 'tool-approval-response') {","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/mistral/src/convert-to-mistral-chat-messages.ts#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: assistant message with unsupported part\n{ role: 'assistant', content: [{ type: 'redacted-reasoning', ... }] }\n// after: keep only supported parts\n{ role: 'assistant', content: [{ type: 'text', text: 'assistant reply' }] }","handlingStrategy":"type-guard","validationCode":"const supportedAssistantTypes = new Set(['text', 'tool-call', 'reasoning']);\nfunction hasUnsupportedAssistantParts(prompt: { messages: { role: string; content: { type: string }[] }[] }[]): boolean {\n  return prompt.some(m => m.role === 'assistant' && m.content.some(p => !supportedAssistantTypes.has(p.type)));\n}","typeGuard":"function isSupportedAssistantPart(part: { type: string }): boolean {\n  return ['text', 'tool-call', 'reasoning'].includes(part.type);\n}","tryCatchPattern":"try {\n  await generateText({ model: mistral(modelId), prompt });\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Unsupported content type in assistant message')) {\n    // strip/convert the offending part type and retry\n  } else {\n    throw error;\n  }\n}","preventionTips":["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."],"tags":["mistral","prompt-conversion","assistant-message","unsupported-part"],"backgroundTag":"unsupported-part-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}