{"record":{"id":"24a7873670260c04","repo":"moeru-ai/airi","slug":"comfyui-returned-no-prompt-id","errorCode":null,"errorMessage":"ComfyUI returned no prompt_id","messagePattern":"ComfyUI returned no prompt_id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts","lineNumber":154,"sourceCode":"        queueResp = await this.fetchWithTimeout(`${this.serverUrl}/prompt`, {\n          method: 'POST',\n          headers: { 'Content-Type': 'application/json' },\n          body: JSON.stringify({ prompt: resolvedPrompt }),\n        }, 15000)\n      }\n      catch (e: any) {\n        throw new Error(`Cannot connect to ComfyUI at ${this.serverUrl}: ${e.message}`)\n      }\n\n      if (!queueResp.ok) {\n        const errorBody = await queueResp.text()\n        throw new Error(`Workflow error: ${errorBody.slice(0, 200)}`)\n      }\n\n      const queueData = await queueResp.json()\n      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","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts#L136-L172","documentation":"Thrown by the ComfyUI provider after a successful (ok) /prompt POST when the parsed JSON queueData has no prompt_id field. ComfyUI normally returns { prompt_id, number, node_errors }; a missing prompt_id means the response shape is unexpected even though the HTTP status was OK.","triggerScenarios":"ComfyUI returned 200 but the JSON body lacks prompt_id — a non-standard proxy rewrote the response, a very old/new ComfyUI build returns a different schema, or an error envelope was returned with a 2xx status. Also possible if the body wasn't valid JSON that parsed into the expected shape.","commonSituations":"ComfyUI version mismatch (API schema changed); a reverse proxy/CDN injected an HTML or wrapper response with 200; ComfyUI returned a validation error object with a 2xx status; the endpoint was redirected to a web UI page returning 200 HTML that parsed oddly.","solutions":["Log the full queueData to inspect the actual response shape from this ComfyUI version.","Update or align the ComfyUI version to one whose /prompt API returns prompt_id.","Remove any reverse proxy rewriting between the client and ComfyUI.","Confirm the serverUrl points at the ComfyUI API and not a web UI path."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function hasPromptId(data: unknown): data is { prompt_id: string } {\n  return typeof data === 'object' && data !== null && typeof (data as any).prompt_id === 'string' && (data as any).prompt_id !== ''\n}","tryCatchPattern":"try {\n  return await provider.generate(request)\n} catch (e) {\n  if (/no prompt_id/.test(errorMessageFrom(e) ?? '')) {\n    // log full queueData; likely version/proxy mismatch\n    throw new Error('ComfyUI response missing prompt_id — check version and proxying')\n  }\n  throw e\n}","preventionTips":["Use a ComfyUI version whose /prompt API returns prompt_id.","Avoid reverse proxies that rewrite the JSON body.","Point serverUrl at the API root, not the web UI."],"tags":["comfyui","api-schema","validation","artistry"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}