{"record":{"id":"e9f5a028d1cb3e18","repo":"vercel/ai","slug":"deepseek-filedata-image-parts-require-inline-dat","errorCode":null,"errorMessage":"DeepSeek `fileData` image parts require inline data, not a URL.","messagePattern":"DeepSeek `fileData` image parts require inline data, not a URL\\.","errorType":"exception","errorClass":"InvalidPromptError","httpStatus":null,"severity":"error","filePath":"packages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts","lineNumber":193,"sourceCode":"                  functionality: `DeepSeek image media type ${resolvedMediaType}`,\n                  message:\n                    'DeepSeek supports JPEG, PNG, GIF, and WebP image inputs.',\n                });\n              }\n\n              if (part.data.type === 'url') {\n                const url = part.data.url.toString();\n\n                if (url.length > 8192) {\n                  throw new InvalidPromptError({\n                    prompt,\n                    message:\n                      'DeepSeek image URLs must not exceed 8192 characters.',\n                  });\n                }\n\n                if (filePartOptions?.fileData === true) {\n                  throw new InvalidPromptError({\n                    prompt,\n                    message:\n                      'DeepSeek `fileData` image parts require inline data, not a URL.',\n                  });\n                }\n\n                userContent.push({\n                  type: 'image_url',\n                  image_url: {\n                    url,\n                    ...(filePartOptions?.imageDetail != null && {\n                      detail: filePartOptions.imageDetail,\n                    }),\n                  },\n                });\n              } else {\n                const dataUrl = `data:${\n                  resolvedMediaType === 'image/jpg'","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts#L175-L211","documentation":"When fileData: true is set in DeepSeek image part provider options, the SDK expects the image content to be inline data, not a URL — fileData mode uploads inline bytes. Supplying a URL part with fileData: true throws InvalidPromptError.","triggerScenarios":"Setting experimental_providerOptions: { deepseek: { fileData: true } } on an image part whose data.type is 'url' — e.g. { type: 'image', image: new URL(...), providerOptions: { deepseek: { fileData: true } } }.","commonSituations":"Reusing the same message-building code for both URL-based and data-based images and globally enabling fileData; misunderstanding fileData as a way to pass URL references to DeepSeek files API.","solutions":["Remove fileData: true from URL-based image parts","Or switch the part to inline data (Uint8Array/binary) and keep fileData: true"],"exampleFix":"// before\n{ type: 'image', image: new URL('https://.../img.png'), providerOptions: { deepseek: { fileData: true } } }\n// after\n{ type: 'image', image: new URL('https://.../img.png') }","handlingStrategy":"validation","validationCode":"function assertFileDataNotUrl(part) {\n  if (part.providerOptions?.deepseek?.fileData === true && (part.image instanceof URL || typeof part.image === 'string' && part.image.startsWith('http'))) {\n    throw new Error('fileData: true requires inline image data, not a URL');\n  }\n}","typeGuard":"function isUrlImagePart(p): p is { image: URL | string } {\n  return typeof p.image === 'string' || p.image instanceof URL;\n}","tryCatchPattern":"try { ... } catch (e) { if (InvalidPromptError.isInstance(e) && /fileData/.test(e.message)) { /* drop fileData or inline the data */ } throw e; }","preventionTips":["Only set fileData: true on binary-data image parts","Centralize DeepSeek image part construction in one helper","Review shared providerOptions spreads for stray fileData flags"],"tags":["deepseek","image","filedata","invalid-combination"],"backgroundTag":"invalid-provider-options","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}