moeru-ai/airi · error · Error
Generation timed out after 5 minutes
Error message
Generation timed out after 5 minutes
What it means
Thrown by the ComfyUI provider's history-polling loop when elapsed time exceeds POLL_TIMEOUT_MS (5 minutes) without the job's history entry appearing/finishing. The loop polls /history/{promptId} at POLL_INTERVAL_MS and bails hard once the timeout elapses.
Source
Thrown at apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts:170
const promptId = queueData.prompt_id
if (!promptId) {
throw new Error('ComfyUI returned no prompt_id')
}
log.log(`[ComfyUI] Queued prompt ${promptId} for job ${jobId}`)
this.updateStatus(jobId, { status: 'running', actionLabel: 'Generating...' })
// 3. Poll /history/{prompt_id} until completion
let historyDone = false
let attempt = 0
const startTime = Date.now()
while (!historyDone) {
await new Promise(r => setTimeout(r, POLL_INTERVAL_MS))
attempt++
if (Date.now() - startTime > POLL_TIMEOUT_MS) {
throw new Error('Generation timed out after 5 minutes')
}
if (attempt % 3 === 0) {
log.log(`[ComfyUI] Polling history for ${promptId}... attempt ${attempt}`)
}
let histResp: Response
try {
histResp = await this.fetchWithTimeout(`${this.serverUrl}/history/${promptId}`, {}, 10000)
}
catch (e: any) {
throw new Error(`ComfyUI disconnected during polling: ${e.message}`)
}
if (histResp.ok) {
const histData = await histResp.json()
if (histData[promptId]) {
let outputs = histData[promptId].outputsView on GitHub (pinned to 27111382b4)
Solutions
- Check the ComfyUI queue/history in its UI to see if the job is still pending or errored.
- Reduce workflow complexity (fewer steps, lower resolution) so jobs finish within the timeout.
- Increase POLL_TIMEOUT_MS if long jobs are expected and the backend can sustain them.
- Ensure ComfyUI has enough VRAM/compute and isn't being starved by other processes.
Defensive patterns
Strategy: retry
Try / catch
try {
return await provider.generate(request)
} catch (e) {
if (/timed out after 5 minutes/.test(errorMessageFrom(e) ?? '')) {
return { error: 'ComfyUI generation exceeded the polling timeout' }
}
throw e
} Prevention
- Make POLL_TIMEOUT_MS configurable for heavier workflows.
- Reduce workflow complexity to fit within the timeout.
- Monitor ComfyUI queue depth to detect saturation early.
When it happens
Trigger: ComfyUI accepted the prompt but the job never completes within the polling timeout — the GPU is saturated and the job is queued indefinitely, the prompt is stuck, ComfyUI crashed mid-generation, or /history keeps returning an empty/incomplete entry.
Common situations: Heavy concurrent load on a single-GPU ComfyUI; a workflow with very large step counts; ComfyUI process died after queuing; the prompt errored silently and never appears in history as complete; POLL_INTERVAL_MS too coarse to catch a fast finish (unlikely to cause this) or network stalls slow each poll.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Image generation timed out after 5 minutes.
- ComfyUI disconnected during polling: ${e.message}
- HTTP ${resp.status}
- Cannot connect to ComfyUI at ${this.serverUrl}: ${e.message}
- Workflow error: ${errorBody.slice(0, 200)}
AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12).
Data as JSON: /api/errors/a33a5eb0d6e84b3b.
Report an issue: GitHub.