moeru-ai/airi · error · Error

ComfyUI returned no prompt_id

Error message

ComfyUI returned no prompt_id

What it means

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.

Source

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

        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))
        attempt++

        if (Date.now() - startTime > POLL_TIMEOUT_MS) {
          throw new Error('Generation timed out after 5 minutes')
        }

View on GitHub (pinned to 27111382b4)

Solutions

  1. Log the full queueData to inspect the actual response shape from this ComfyUI version.
  2. Update or align the ComfyUI version to one whose /prompt API returns prompt_id.
  3. Remove any reverse proxy rewriting between the client and ComfyUI.
  4. Confirm the serverUrl points at the ComfyUI API and not a web UI path.
Defensive patterns

Strategy: try-catch

Type guard

function hasPromptId(data: unknown): data is { prompt_id: string } {
  return typeof data === 'object' && data !== null && typeof (data as any).prompt_id === 'string' && (data as any).prompt_id !== ''
}

Try / catch

try {
  return await provider.generate(request)
} catch (e) {
  if (/no prompt_id/.test(errorMessageFrom(e) ?? '')) {
    // log full queueData; likely version/proxy mismatch
    throw new Error('ComfyUI response missing prompt_id — check version and proxying')
  }
  throw e
}

Prevention

When it happens

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

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

Related errors


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