{"record":{"id":"77ef42feff9f3f24","repo":"moeru-ai/airi","slug":"workflow-error-errorbody-slice-0-200","errorCode":null,"errorMessage":"Workflow error: ${errorBody.slice(0, 200)}","messagePattern":"Workflow error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts","lineNumber":148,"sourceCode":"\n      // 2. POST /prompt to queue the workflow\n      this.updateStatus(jobId, { status: 'running', actionLabel: 'Queuing in ComfyUI...' })\n\n      let queueResp: Response\n      try {\n        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))","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts#L130-L166","documentation":"Thrown by the ComfyUI provider when the POST to /prompt returns an HTTP response with a non-ok status. The first 200 characters of the response body are captured as the error message so the caller sees ComfyUI's workflow validation output.","triggerScenarios":"ComfyUI received the /prompt request but rejected the workflow JSON — invalid node ids, missing required inputs, references to unloaded models/LoRAs, schema mismatches, or a malformed prompt graph. The response body typically names the offending node/field.","commonSituations":"Workflow template references a checkpoint or LoRA not installed in ComfyUI; node IDs changed after a ComfyUI update; placeholder replacement ({{PROMPT}}/{{IMAGE}}) left a literal or injected invalid JSON; image upload name mismatch; missing required widget values.","solutions":["Read the captured body text (first 200 chars) in the error/log to find the offending node or missing model.","Ensure all checkpoints/LoRAs/vae referenced by the workflow template are installed in ComfyUI's models directory.","Validate the resolved prompt JSON in ComfyUI's UI before sending it programmatically.","Confirm placeholder replacement produced valid values (no empty {{IMAGE}} when an image is expected)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the workflow references installed models before sending\n// (pseudo: inspect template for checkpoint/loRA names present in ComfyUI models dir)\nfunction workflowReferencesInstalledModels(template: any, installed: string[]): boolean {\n  const refs = extractModelRefs(template) // returns names referenced by ClassLoader etc.\n  return refs.every(name => installed.includes(name))\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await provider.generate(request)\n} catch (e) {\n  if (/^Workflow error:/.test(errorMessageFrom(e) ?? '')) {\n    // parse the captured body to guide the user (missing node/model)\n    throw e\n  }\n  throw e\n}","preventionTips":["Test workflow JSON in ComfyUI's UI before using it programmatically.","Keep referenced checkpoints/LoRAs/VAEs installed on the ComfyUI host.","Ensure placeholder substitution yields valid JSON (no empty {{IMAGE}})."],"tags":["comfyui","workflow","validation","artistry"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}