{"record":{"id":"3f3a7ef4bd0a8cab","repo":"vercel/ai","slug":"unsupported-tool-content-part-type-contentpart","errorCode":null,"errorMessage":"unsupported tool content part type: ${contentPart.type}","messagePattern":"unsupported tool content part type: (.+?)","errorType":"exception","errorClass":"UnsupportedFunctionalityError","httpStatus":null,"severity":"error","filePath":"packages/amazon-bedrock/src/convert-to-amazon-bedrock-chat-messages.ts","lineNumber":473,"sourceCode":"                                      ),\n                                    name: contentPart.filename\n                                      ? stripFileExtension(contentPart.filename)\n                                      : generateDocumentName(),\n                                    source: {\n                                      bytes: convertToBase64(\n                                        contentPart.data.data,\n                                      ),\n                                    },\n                                    ...(enableCitations && {\n                                      citations: { enabled: true },\n                                    }),\n                                  },\n                                };\n                              }\n                            }\n                          }\n                          default: {\n                            throw new UnsupportedFunctionalityError({\n                              functionality: `unsupported tool content part type: ${contentPart.type}`,\n                            });\n                          }\n                        }\n                      }),\n                    );\n                    break;\n                  }\n                  case 'text':\n                  case 'error-text':\n                    toolResultContent = [{ text: output.value }];\n                    break;\n                  case 'execution-denied':\n                    toolResultContent = [\n                      { text: output.reason ?? 'Tool call execution denied.' },\n                    ];\n                    break;\n                  case 'json':","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/amazon-bedrock/src/convert-to-amazon-bedrock-chat-messages.ts#L455-L491","documentation":"The tool-result content converter throws UnsupportedFunctionalityError for any content part whose type is not one of the handled kinds (text, file, etc.). Bedrock's Converse API only supports a fixed set of tool result content block types, so unknown part types are rejected at conversion time.","triggerScenarios":"Including a content part of an unhandled type (e.g. 'image' or a future/custom part type) inside a tool result's content array when targeting Bedrock.","commonSituations":"Tool results written for another provider (which may accept images or richer parts) are reused with Bedrock; or SDK version drift introduces new part types the converter does not handle yet.","solutions":["Only return 'text' (and supported 'file') content parts from tools when using Bedrock.","Convert unsupported part types to text (e.g. describe or serialize the content) before returning them.","Upgrade @ai-sdk/amazon-bedrock in case support for the part type was added.","If images are needed, return them as message content parts rather than tool result parts."],"exampleFix":"// before\n{ role: 'tool', content: [{ type: 'image', image: bytes }] }\n// after\n{ role: 'tool', content: [{ type: 'text', text: 'Screenshot captured (see description)...' }] }","handlingStrategy":"validation","validationCode":"const BEDROCK_TOOL_RESULT_PART_TYPES = new Set(['text', 'file']);\nfunction validateToolResultContent(content) {\n  for (const part of content) {\n    if (!BEDROCK_TOOL_RESULT_PART_TYPES.has(part.type)) {\n      throw new Error(`Part type '${part.type}' unsupported in Bedrock tool results`);\n    }\n  }\n}","typeGuard":"function isBedrockToolResultPart(part) {\n  return part.type === 'text' || part.type === 'file';\n}","tryCatchPattern":"try {\n  await generateText({ model, messages });\n} catch (error) {\n  if (UnsupportedFunctionalityError.isInstance(error) && error.message.includes('unsupported tool content part type')) {\n    console.error('Tool emitted a part type Bedrock cannot represent; serialize it to text.');\n  }\n  throw error;\n}","preventionTips":["Restrict tool return shapes to text (and supported file) parts for Bedrock deployments.","Normalize tool outputs with a provider-specific adapter before returning them.","Check release notes when upgrading the SDK for new tool result part types."],"tags":["unsupported-functionality","bedrock","tool-result","content-part"],"backgroundTag":"unsupported-media-type","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}