vercel/ai · error · Error
URL-based images are not supported for Amazon Bedrock image
Error message
URL-based images are not supported for Amazon Bedrock image editing. Please provide the image data directly.
What it means
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.
Source
Thrown at packages/amazon-bedrock/src/amazon-bedrock-image-model.ts:306
(response.status ? `Status: ${response.status}` : ''),
);
}
return {
images: response.images,
warnings,
response: {
timestamp: currentDate,
modelId: this.modelId,
headers: responseHeaders,
},
};
}
}
function getBase64Data(file: ImageModelV4File): string {
if (file.type === 'url') {
throw new Error(
'URL-based images are not supported for Amazon Bedrock image editing. ' +
'Please provide the image data directly.',
);
}
if (file.data instanceof Uint8Array) {
return convertUint8ArrayToBase64(file.data);
}
// Already base64 string
return file.data;
}
// minimal version of the schema, focussed on what is needed for the implementation
// this approach limits breakages when the API changes and increases efficiency
const amazonBedrockImageResponseSchema = z.object({
// Normal successful response
images: z.array(z.string()).optional(),View on GitHub (pinned to 69428b1f8b)
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
Example fix
// before
await generateImage({ model, prompt: 'make it snowy', images: [{ type: 'url', url: 'https://example.com/photo.png' }] });
// after
const res = await fetch('https://example.com/photo.png');
const data = new Uint8Array(await res.arrayBuffer());
await generateImage({ model, prompt: 'make it snowy', images: [{ type: 'data', data, mediaType: 'image/png' }] }); Defensive patterns
Strategy: validation
Validate before calling
for (const img of images) {
if (img.type === 'url') {
throw new Error('Bedrock image editing requires image data, not URLs — download first');
}
} Type guard
function isImageFileData(file: ImageModelV4File): boolean {
return file.type === 'data';
} Prevention
- Always convert URL sources to bytes before Bedrock image editing
- Use S3 retrieval + raw bytes for S3-hosted images
When it happens
Trigger: 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://...' }].
Common situations: 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.
Related errors
- Unsupported task type: ${taskType}
- Amazon Bedrock request was moderated: ${reasons.join(', ')}
- Amazon Bedrock returned no images. Status: ${response.status
- AI_UnsupportedFunctionalityError
- Multiple system messages that are separated by user/assistan
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/9f2e3e8dbe058d37.
Report an issue: GitHub.