moeru-ai/airi · error · Error

Workflow error: ${errorBody.slice(0, 200)}

Error message

Workflow error: ${errorBody.slice(0, 200)}

What it means

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.

Source

Thrown at apps/stage-tamagotchi/src/main/services/airi/widgets/providers/comfyui.ts:148

      // 2. POST /prompt to queue the workflow
      this.updateStatus(jobId, { status: 'running', actionLabel: 'Queuing in ComfyUI...' })

      let queueResp: Response
      try {
        queueResp = await this.fetchWithTimeout(`${this.serverUrl}/prompt`, {
          method: 'POST',
          headers: { 'Content-Type': 'application/json' },
          body: JSON.stringify({ prompt: resolvedPrompt }),
        }, 15000)
      }
      catch (e: any) {
        throw new Error(`Cannot connect to ComfyUI at ${this.serverUrl}: ${e.message}`)
      }

      if (!queueResp.ok) {
        const errorBody = await queueResp.text()
        throw new Error(`Workflow error: ${errorBody.slice(0, 200)}`)
      }

      const queueData = await queueResp.json()
      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))

View on GitHub (pinned to 27111382b4)

Solutions

  1. Read the captured body text (first 200 chars) in the error/log to find the offending node or missing model.
  2. Ensure all checkpoints/LoRAs/vae referenced by the workflow template are installed in ComfyUI's models directory.
  3. Validate the resolved prompt JSON in ComfyUI's UI before sending it programmatically.
  4. Confirm placeholder replacement produced valid values (no empty {{IMAGE}} when an image is expected).
Defensive patterns

Strategy: validation

Validate before calling

// Validate the workflow references installed models before sending
// (pseudo: inspect template for checkpoint/loRA names present in ComfyUI models dir)
function workflowReferencesInstalledModels(template: any, installed: string[]): boolean {
  const refs = extractModelRefs(template) // returns names referenced by ClassLoader etc.
  return refs.every(name => installed.includes(name))
}

Try / catch

try {
  return await provider.generate(request)
} catch (e) {
  if (/^Workflow error:/.test(errorMessageFrom(e) ?? '')) {
    // parse the captured body to guide the user (missing node/model)
    throw e
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of moeru-ai/airi@27111382b4 (2026-08-12). Data as JSON: /api/errors/77ef42feff9f3f24. Report an issue: GitHub.