vercel/ai · error · Error
Amazon Bedrock returned no images. Status: ${response.status
Error message
Amazon Bedrock returned no images. Status: ${response.status} What it means
After the moderation check, the provider verifies the Nova Canvas response actually contains images. If response.images is missing or empty (for any status other than moderation), doGenerate throws 'Amazon Bedrock returned no images' with the response status appended. This guards against silent empty results from the provider.
Source
Thrown at packages/amazon-bedrock/src/amazon-bedrock-image-model.ts:286
),
abortSignal,
fetch: this.config.fetch,
});
// Handle moderated/blocked requests
if (response.status === 'Request Moderated') {
const moderationReasons = response.details?.['Moderation Reasons'];
const reasons = Array.isArray(moderationReasons)
? moderationReasons
: ['Unknown'];
throw new Error(
`Amazon Bedrock request was moderated: ${reasons.join(', ')}`,
);
}
// Check if images are present
if (!response.images || response.images.length === 0) {
throw new Error(
'Amazon Bedrock returned no images. ' +
(response.status ? `Status: ${response.status}` : ''),
);
}
return {
images: response.images,
warnings,
response: {
timestamp: currentDate,
modelId: this.modelId,
headers: responseHeaders,
},
};
}
}
function getBase64Data(file: ImageModelV4File): string {View on GitHub (pinned to 69428b1f8b)
Solutions
- Update @ai-sdk/amazon-bedrock to the latest version
- Validate your generation config (width/height/quality/count) against the Nova Canvas limits for your model ID
- Simplify the prompt and retry to rule out soft filtering
- Log/report the response.status from the error message; open an issue with AWS if a valid request consistently yields no images
Example fix
// before
await generateImage({ model, prompt: 'a cat', providerOptions: { bedrock: { imageGenerationConfig: { width: 99999, height: 99999 } } } });
// after
await generateImage({ model, prompt: 'a cat', providerOptions: { bedrock: { imageGenerationConfig: { width: 1024, height: 1024 } } } }); Defensive patterns
Strategy: retry
Validate before calling
// validate generation config against model limits, e.g. 320–4096 px for Nova Canvas guard(width >= 320 && width <= 4096 && height >= 320 && height <= 4096)
Try / catch
try {
const { images } = await generateImage({ model, prompt });
} catch (e) {
if (e instanceof Error && e.message.includes('returned no images')) {
// adjust prompt/config and retry
}
} Prevention
- Validate width/height/quality/count against Nova Canvas limits
- Retry with a simplified prompt when generation returns empty
- Update the provider package for newer model response shapes
When it happens
Trigger: generateImage against a bedrock image model where the API responds successfully but with zero images — e.g. unacknowledged filtering, invalid generation config (width/height out of range), or quality/seed issues.
Common situations: Invalid imageGenerationConfig dimensions for the model; prompt rejected softly by the model; model returning an unusual status the package doesn't explicitly map; new Nova model versions with different response shapes on outdated provider packages.
Related errors
- AI_EmptyResponseBodyError
- Unsupported task type: ${taskType}
- Amazon Bedrock request was moderated: ${reasons.join(', ')}
- URL-based images are not supported for Amazon Bedrock image
- No output generated.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/7897e3f26fabfc51.
Report an issue: GitHub.