{"record":{"id":"a33a5eb0d6e84b3b","repo":"moeru-ai/airi","slug":"generation-timed-out-after-5-minutes","errorCode":null,"errorMessage":"Generation timed out after 5 minutes","messagePattern":"Generation timed out after 5 minutes","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts","lineNumber":170,"sourceCode":"      const promptId = queueData.prompt_id\n      if (!promptId) {\n        throw new Error('ComfyUI returned no prompt_id')\n      }\n\n      log.log(`[ComfyUI] Queued prompt ${promptId} for job ${jobId}`)\n      this.updateStatus(jobId, { status: 'running', actionLabel: 'Generating...' })\n\n      // 3. Poll /history/{prompt_id} until completion\n      let historyDone = false\n      let attempt = 0\n      const startTime = Date.now()\n\n      while (!historyDone) {\n        await new Promise(r => setTimeout(r, POLL_INTERVAL_MS))\n        attempt++\n\n        if (Date.now() - startTime > POLL_TIMEOUT_MS) {\n          throw new Error('Generation timed out after 5 minutes')\n        }\n\n        if (attempt % 3 === 0) {\n          log.log(`[ComfyUI] Polling history for ${promptId}... attempt ${attempt}`)\n        }\n\n        let histResp: Response\n        try {\n          histResp = await this.fetchWithTimeout(`${this.serverUrl}/history/${promptId}`, {}, 10000)\n        }\n        catch (e: any) {\n          throw new Error(`ComfyUI disconnected during polling: ${e.message}`)\n        }\n\n        if (histResp.ok) {\n          const histData = await histResp.json()\n          if (histData[promptId]) {\n            let outputs = histData[promptId].outputs","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts#L152-L188","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  return await provider.generate(request)\n} catch (e) {\n  if (/timed out after 5 minutes/.test(errorMessageFrom(e) ?? '')) {\n    return { error: 'ComfyUI generation exceeded the polling timeout' }\n  }\n  throw e\n}","preventionTips":["Make POLL_TIMEOUT_MS configurable for heavier workflows.","Reduce workflow complexity to fit within the timeout.","Monitor ComfyUI queue depth to detect saturation early."],"tags":["comfyui","timeout","polling","artistry"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}