{"record":{"id":"6fcf82ae53328cb9","repo":"vercel/ai","slug":"file-data-urls-in-assistant-messages-are-not-supp","errorCode":null,"errorMessage":"'File data URLs in assistant messages are not supported' functionality is not supported.","messagePattern":"'File data URLs in assistant messages are not supported' functionality is not supported\\.","errorType":"exception","errorClass":"UnsupportedFunctionalityError","httpStatus":null,"severity":"error","filePath":"packages/google/src/convert-to-google-messages.ts","lineNumber":383,"sourceCode":"                        text: part.text,\n                        thoughtSignature,\n                      };\n                }\n\n                case 'reasoning': {\n                  return part.text.length === 0\n                    ? undefined\n                    : {\n                        text: part.text,\n                        thought: true,\n                        thoughtSignature,\n                      };\n                }\n\n                case 'reasoning-file': {\n                  switch (part.data.type) {\n                    case 'url': {\n                      throw new UnsupportedFunctionalityError({\n                        functionality:\n                          'File data URLs in assistant messages are not supported',\n                      });\n                    }\n                    case 'data': {\n                      return {\n                        inlineData: {\n                          mimeType: part.mediaType,\n                          data: convertToBase64(part.data.data),\n                        },\n                        thought: true,\n                        thoughtSignature,\n                      };\n                    }\n                  }\n                  break;\n                }\n","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/google/src/convert-to-google-messages.ts#L365-L401","documentation":"Assistant ('reasoning-file') parts whose data is a URL cannot be converted for Google: the Gemini/Vertex content format requires reasoning/thinking file attachments as inline bytes, not remote URLs. The converter throws UnsupportedFunctionalityError when it hits a reasoning-file part with `type: 'url'`.","triggerScenarios":"A message array containing an assistant message with a `reasoning-file` part whose `data.type` is 'url' (e.g. from a previous provider response that returned a hosted file URL), sent to a Google model.","commonSituations":"Carrying multi-provider conversation history where an earlier provider returned hosted thinking-file URLs; persisting assistant outputs as URLs in a database and replaying them against Google.","solutions":["Download the file and resend it as inline data: `data: { type: 'data', mediaType, data: base64 }`.","Strip reasoning-file parts from the history when switching to Google models.","Store base64/raw bytes instead of URLs in your message persistence layer."],"exampleFix":"// before\n{ type: 'reasoning-file', data: { type: 'url', url: 'https://.../thinking.json' } }\n// after\n{ type: 'reasoning-file', data: { type: 'data', mediaType: 'application/json', data: base64Content } }","handlingStrategy":"try-catch","validationCode":"function reasoningFilesHaveNoUrls(messages) {\n  return messages.flatMap(m => Array.isArray(m.content) ? m.content : [])\n    .every(p => p.type !== 'reasoning-file' || p.data?.type !== 'url');\n}","typeGuard":"function isDataReasoningFile(part) {\n  return part?.type === 'reasoning-file' && part?.data?.type === 'data';\n}","tryCatchPattern":"try {\n  await streamText({ model: googleModel, messages });\n} catch (e) {\n  if (e?.message?.includes('File data URLs in assistant messages are not supported')) {\n    const sanitized = messages.map(m => m.role === 'assistant'\n      ? { ...m, content: m.content.filter(p => p.type !== 'reasoning-file') } : m);\n    return streamText({ model: googleModel, messages: sanitized });\n  } throw e;\n}","preventionTips":["Persist reasoning files as base64 bytes, not hosted URLs.","Strip reasoning-file parts when switching providers mid-conversation.","Normalize message history to a provider-neutral, data-inline format."],"tags":["google","assistant-messages","file-parts","messages"],"backgroundTag":"file-url-unsupported-in-assistant-message","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}