moeru-ai/airi · error · Error
Generation failed
Error message
Generation failed
What it means
Thrown by generateHeadless when the polling loop receives a terminal 'failed' status from provider.getStatus. If lastStatus.error is present its value is used as the message, otherwise the generic 'Generation failed' is thrown. This is the provider reporting that the image job itself failed, not a transport error.
Source
Thrown at apps/stage-tamagotchi/src/main/services/airi/widgets/artistry-bridge.ts:213
log.error(`[Headless] Job ${job.jobId} timed out after 5 minutes.`)
throw new Error('Image generation timed out after 5 minutes.')
}
log.log(`[Headless] Polling status for job: ${job.jobId}...`)
lastStatus = await provider.getStatus(job.jobId)
log.log(`[Headless] Status for job ${job.jobId}: ${lastStatus.status}`)
if (lastStatus.status === 'succeeded' || lastStatus.status === 'failed') {
isDone = true
}
if (!isDone) {
await new Promise(resolve => setTimeout(resolve, 2000))
}
}
if (lastStatus.status === 'failed') {
log.error(`[Headless] Job ${job.jobId} failed: ${lastStatus.error || 'Unknown error'}`)
throw new Error(lastStatus.error || 'Generation failed')
}
log.log(`[Headless] Job ${job.jobId} succeeded. Image URL: ${lastStatus.imageUrl}`)
const base64 = lastStatus.imageUrl ? await downloadImageAsBase64(lastStatus.imageUrl) : undefined
return { imageUrl: lastStatus.imageUrl, base64 }
}
else {
// For providers with callbacks (like ComfyUI), we wait for the result via the callback
log.log(`[Headless] Using callback-based wait logic for provider: ${requestedProvider}`)
return new Promise<{ imageUrl?: string, base64?: string }>((resolve, reject) => {
const timeout = 1000 * 60 * 5 // 5 minutes timeout
const timer = setTimeout(() => {
reject(new Error('Image generation timed out after 5 minutes.'))
}, timeout)
provider.setJobCallback(request.extra?.internalJobId as string, async (status) => {
if (status.status === 'succeeded') {
clearTimeout(timer)View on GitHub (pinned to 27111382b4)
Solutions
- Read lastStatus.error from the logs to get the backend-specific failure reason and address it (free VRAM, fix workflow, adjust prompt).
- Retry the generation after the backend recovers or with simpler parameters.
- Validate prompt/resolution inputs before submission to avoid backend rejections.
- For ComfyUI, verify the workflow template and referenced checkpoints are installed.
Defensive patterns
Strategy: try-catch
Try / catch
try {
return await generateHeadless(params)
} catch (e) {
const msg = errorMessageFrom(e) ?? ''
if (/generation failed/i.test(msg) || /failed$/i.test(msg)) {
return { error: `Image generation failed: ${msg}` }
}
throw e
} Prevention
- Surface lastStatus.error to the user so they can correct the prompt/workflow.
- Validate prompt/resolution against provider constraints before submission.
- Keep backend models/checkpoints installed so generation doesn't fail mid-run.
When it happens
Trigger: The provider backend accepted the job and started it, but the generation later failed — e.g. model load error, out-of-memory on the GPU, invalid prompt/workflow, content filter rejection, or an internal backend exception surfaced through getStatus.error.
Common situations: ComfyUI ran out of VRAM mid-generation; the workflow JSON referenced a missing node/model; an API provider rejected the prompt for policy reasons; the model crashed; an invalid resolution was requested.
Related errors
- Artistry provider is disabled.
- Provider '${requestedProvider}' not found.
- Image generation timed out after 5 minutes.
- Nano Banana API Key not configured
- Nano Banana API Error
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/e86eaf9cc009b13e.
Report an issue: GitHub.