vercel/ai · error
Black Forest Labs generation failed.
Error message
Black Forest Labs generation failed.
What it means
While polling a Black Forest Labs image generation task, the SDK treats a poll response status of 'Error' or 'Failed' as terminal and throws this plain Error from `pollForImageUrl`. It means BFL itself reported the generation failed, so no image URL will ever be produced for this request.
Source
Thrown at packages/black-forest-labs/src/black-forest-labs-image-model.ts:357
});
const status = value.status;
if (status === 'Ready') {
if (typeof value.result?.sample === 'string') {
return {
imageUrl: value.result.sample,
seed: value.result.seed ?? undefined,
start_time: value.result.start_time ?? undefined,
end_time: value.result.end_time ?? undefined,
duration: value.result.duration ?? undefined,
};
}
throw new Error(
'Black Forest Labs poll response is Ready but missing result.sample',
);
}
if (status === 'Error' || status === 'Failed') {
throw new Error('Black Forest Labs generation failed.');
}
await delay(pollIntervalMillis);
}
throw new Error('Black Forest Labs generation timed out.');
}
}
function convertSizeToAspectRatio(
size: string,
): BlackForestLabsAspectRatio | undefined {
const [wStr, hStr] = size.split('x');
const width = Number(wStr);
const height = Number(hStr);
if (
!Number.isFinite(width) ||
!Number.isFinite(height) ||View on GitHub (pinned to 69428b1f8b)
Solutions
- Retry the same request once to rule out a transient BFL server-side failure.
- Check the prompt against BFL content policy and adjust wording that could trigger moderation.
- Verify the requested size/aspect ratio is one supported by the chosen FLUX model.
- Confirm your BFL API account is active, funded, and under quota; check BFL status page for incidents.
Example fix
// before
const { image } = await generateImage({ model: bfl.image('flux-pro-1.1'), prompt, size: '1000x1000' });
// after: use a supported size and handle failure
try {
const { image } = await generateImage({ model: bfl.image('flux-pro-1.1'), prompt, size: '1024x1024' });
} catch (e) {
if ((e as Error).message === 'Black Forest Labs generation failed.') {
console.error('BFL rejected the generation; check prompt/size/quota', e);
} else { throw e; }
} Defensive patterns
Strategy: try-catch
Validate before calling
const SUPPORTED_SIZES = ['1024x1024', '1024x768', '768x1024'];
if (!SUPPORTED_SIZES.includes(size)) throw new Error(`Unsupported BFL size: ${size}`); Try / catch
try {
const { image } = await generateImage({ model: bfl.image('flux-pro-1.1'), prompt, size });
} catch (e) {
if ((e as Error).message === 'Black Forest Labs generation failed.') {
// surface to user as rejected/failed generation, optionally retry once
} else throw e;
} Prevention
- Validate prompt against content-moderation heuristics before submitting.
- Restrict size/aspect-ratio inputs to the model's documented supported values.
- Monitor BFL quota/billing and retry only once for transient server errors.
When it happens
Trigger: Calling generateImage with a Black Forest Labs image model and the polling loop receives a response whose status is 'Error' or 'Failed' — typically because the prompt was rejected by content moderation, the request was malformed (unsupported size/aspect ratio), or BFL had a server-side failure for the task.
Common situations: Prompts violating BFL content policy; invalid image size strings passed through convertSizeToAspectRatio; insufficient quota or billing issues at BFL; transient BFL service incidents.
Related errors
- Black Forest Labs poll response is Ready but missing result.
- Black Forest Labs generation timed out.
- Black Forest Labs supports up to 10 input images.
- Fireworks poll response is Ready but missing result.sample
- Fireworks image generation failed with status: ${status}
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/ff520f949de6b375.
Report an issue: GitHub.