vercel/ai · error · InvalidResponseDataError
Image generation completed but no image was found.
Error message
Image generation completed but no image was found.
What it means
Luma's image generation reached the 'completed' state, but the polled status response contains no assets.image URL. pollForImageUrl treats a completed generation without an image as invalid provider data and throws InvalidResponseDataError including the full statusResponse as data.
Source
Thrown at packages/luma/src/luma-image-model.ts:197
pollSettings?.pollIntervalMillis ?? this.pollIntervalMillis;
for (let i = 0; i < maxPollAttempts; i++) {
const { value: statusResponse } = await getFromApi({
url,
validateUrl: false,
headers,
abortSignal,
fetch: this.config.fetch,
failedResponseHandler: this.createLumaErrorHandler(),
successfulResponseHandler: createJsonResponseHandler(
lumaGenerationResponseSchema,
),
});
switch (statusResponse.state) {
case 'completed':
if (!statusResponse.assets?.image) {
throw new InvalidResponseDataError({
data: statusResponse,
message: `Image generation completed but no image was found.`,
});
}
return statusResponse.assets.image;
case 'failed':
throw new InvalidResponseDataError({
data: statusResponse,
message: `Image generation failed.`,
});
}
await delay(pollIntervalMillis);
}
throw new Error(
`Image generation timed out after ${this.maxPollAttempts} attempts.`,
);
}View on GitHub (pinned to 69428b1f8b)
Solutions
- Inspect error.data (statusResponse) to confirm what the API actually returned
- Retry the generation; if reproducible, check the Luma dashboard/API for the generation id
- Poll promptly — assets may expire on finished generations
- Upgrade @ai-sdk/luma to track Luma API schema changes
- Report to Luma support if completed jobs consistently lack assets
Example fix
// before
const { image } = await generateImage({ model: luma.image('photon-1'), prompt: 'cat' }); // completed, no image
// after
// retry and handle
try {
const { image } = await generateImage({ model: luma.image('photon-1'), prompt: 'cat' });
} catch (e) {
if (InvalidResponseDataError.isInstance(e)) { /* inspect e.data, retry generation */ }
} Defensive patterns
Strategy: retry
Type guard
function hasCompletedImage(r: unknown): r is { state: 'completed'; assets: { image: string } } {
const s = r as any;
return s?.state === 'completed' && typeof s?.assets?.image === 'string';
} Try / catch
try {
const { image } = await generateImage({ model: luma.image('photon-1'), prompt });
} catch (e) {
if (InvalidResponseDataError.isInstance(e) && e.data?.state === 'completed') {
// retry generation or check the generation id in Luma's API
} else throw e;
} Prevention
- Consume image results promptly after completion
- Add one retry with backoff around generateImage
- Keep @ai-sdk/luma updated with Luma API changes
- Log e.data (statusResponse) to detect recurring provider-side anomalies
When it happens
Trigger: Polling a Luma generation whose state is 'completed' while assets or assets.image is undefined/null — e.g. Luma completed the job but failed to attach the asset, or the response schema changed.
Common situations: Luma API-side anomaly, expired or purged assets on long-polling jobs, proxy/mocks stripping fields, or SDK version lagging behind Luma API changes.
Related errors
- Image generation failed.
- Black Forest Labs poll response is Ready but missing result.
- Fireworks poll response is Ready but missing result.sample
- Video generation timed out after ${timeoutMs}ms.
- ALIBABA_VIDEO_GENERATION_ERROR
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/1210e71db7a869e3.
Report an issue: GitHub.