{"record":{"id":"9f2e3e8dbe058d37","repo":"vercel/ai","slug":"url-based-images-are-not-supported-for-amazon-bedr","errorCode":null,"errorMessage":"URL-based images are not supported for Amazon Bedrock image editing. Please provide the image data directly.","messagePattern":"URL-based images are not supported for Amazon Bedrock image editing\\. Please provide the image data directly\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/amazon-bedrock/src/amazon-bedrock-image-model.ts","lineNumber":306,"sourceCode":"          (response.status ? `Status: ${response.status}` : ''),\n      );\n    }\n\n    return {\n      images: response.images,\n      warnings,\n      response: {\n        timestamp: currentDate,\n        modelId: this.modelId,\n        headers: responseHeaders,\n      },\n    };\n  }\n}\n\nfunction getBase64Data(file: ImageModelV4File): string {\n  if (file.type === 'url') {\n    throw new Error(\n      'URL-based images are not supported for Amazon Bedrock image editing. ' +\n        'Please provide the image data directly.',\n    );\n  }\n\n  if (file.data instanceof Uint8Array) {\n    return convertUint8ArrayToBase64(file.data);\n  }\n\n  // Already base64 string\n  return file.data;\n}\n\n// minimal version of the schema, focussed on what is needed for the implementation\n// this approach limits breakages when the API changes and increases efficiency\nconst amazonBedrockImageResponseSchema = z.object({\n  // Normal successful response\n  images: z.array(z.string()).optional(),","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/amazon-bedrock/src/amazon-bedrock-image-model.ts#L288-L324","documentation":"For Bedrock image editing (e.g. Nova inpainting/outpainting/color-guided generation), the source image must be embedded in the request as base64 data. getBase64Data throws when given a file of type 'url' because Bedrock cannot fetch remote URLs itself. You must download the image and pass its bytes/data yourself.","triggerScenarios":"Calling generateImage with a bedrock image model and an editing prompt while supplying the reference image via a URL — e.g. images: [{ type: 'url', url: 'https://...' }].","commonSituations":"Passing an S3/CDN/web image URL directly as the source image; assuming parity with providers that accept URLs server-side; migrating code from OpenAI image editing to Bedrock.","solutions":["Download the image yourself and pass it as data — fetch(url), then pass the Uint8Array/ArrayBuffer/base64 string in `images`","If the image lives in S3, retrieve it with the AWS SDK and pass the bytes","Keep URL support only for models that accept it; for Bedrock always provide raw image data"],"exampleFix":"// before\nawait generateImage({ model, prompt: 'make it snowy', images: [{ type: 'url', url: 'https://example.com/photo.png' }] });\n// after\nconst res = await fetch('https://example.com/photo.png');\nconst data = new Uint8Array(await res.arrayBuffer());\nawait generateImage({ model, prompt: 'make it snowy', images: [{ type: 'data', data, mediaType: 'image/png' }] });","handlingStrategy":"validation","validationCode":"for (const img of images) {\n  if (img.type === 'url') {\n    throw new Error('Bedrock image editing requires image data, not URLs — download first');\n  }\n}","typeGuard":"function isImageFileData(file: ImageModelV4File): boolean {\n  return file.type === 'data';\n}","tryCatchPattern":null,"preventionTips":["Always convert URL sources to bytes before Bedrock image editing","Use S3 retrieval + raw bytes for S3-hosted images"],"tags":["bedrock","image-generation","unsupported-functionality","url-input"],"backgroundTag":"url-image-not-supported","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}