moeru-ai/airi · error · Error

HTTP ${resp.status}

Error message

HTTP ${resp.status}

What it means

Thrown by the ComfyUI connection-test handler (artistryTestComfyUIConnection) when fetch of <url>/system_stats returns a non-ok HTTP status. The test uses a 10-second AbortController timeout; a non-ok response (not a network throw) produces this message with the raw status code.

Source

Thrown at apps/stage-tamagotchi/src/main/services/airi/widgets/artistry-bridge.ts:501

      // Update character-level defaults (volatile only)
      cardDefaults.provider = payload.provider
      cardDefaults.model = payload.model
      cardDefaults.promptPrefix = payload.promptPrefix
      cardDefaults.options = payload.options
      cardDefaults.globals = payload.globals
    })

    defineInvokeHandler(params.context, artistryTestComfyUIConnection, async (payload) => {
      log.log(`🔌 Testing ComfyUI connection at: ${payload.url}`)
      try {
        const url = payload.url.replace(/\/+$/, '')
        const controller = new AbortController()
        const id = setTimeout(() => controller.abort(), 10000)
        const resp = await fetch(`${url}/system_stats`, { signal: controller.signal })
        clearTimeout(id)

        if (!resp.ok)
          throw new Error(`HTTP ${resp.status}`)
        const data = await resp.json() as { devices?: Array<{ name?: string, vram_total?: number }> }
        const gpus = data.devices?.map(d => d.name).join(', ') || 'Unknown GPU'
        const vram = data.devices?.[0]?.vram_total
        const vramStr = vram ? `${(vram / 1024 / 1024 / 1024).toFixed(1)} GB` : ''
        return {
          ok: true,
          info: `Connected — ${gpus}${vramStr ? ` (${vramStr} VRAM)` : ''}`,
        }
      }
      catch (e: unknown) {
        const message = errorMessageFrom(e) ?? 'Unknown connection error'
        log.error(`🔌 ComfyUI connection test failed: ${message}`)
        return {
          ok: false,
          info: `Failed: ${message}`,
        }
      }
    })

View on GitHub (pinned to 27111382b4)

Solutions

  1. Verify the URL points to a running ComfyUI instance and that /system_stats responds in a browser.
  2. Check for a reverse proxy or auth layer intercepting the request and return the correct ComfyUI base URL.
  3. Confirm the ComfyUI version exposes /system_stats (update or downgrade as needed).
  4. Look at the HTTP status code in the error to pinpoint the layer returning it.
Defensive patterns

Strategy: validation

Validate before calling

async function canReachComfyUI(url: string): Promise<boolean> {
  try {
    const resp = await fetch(`${url.replace(/\/+$/, '')}/system_stats`, { signal: AbortSignal.timeout(10000) })
    return resp.ok
  } catch {
    return false
  }
}

Try / catch

try {
  return await testComfyUIConnection({ url })
} catch (e) {
  return { ok: false, info: `Connection failed: ${errorMessageFrom(e)}` }
}

Prevention

When it happens

Trigger: User triggers a ComfyUI connection test in settings; the URL is reachable and returns a response, but with an error status (404 if /system_stats doesn't exist, 401/403 if auth is required, 500 if ComfyUI is erroring). Distinct from a network failure which would be caught separately.

Common situations: Wrong base URL pointing to a different service; ComfyUI behind a reverse proxy that blocks /system_stats; ComfyUI version that renamed the endpoint; auth/CGI gateway returning 401; ComfyUI partially up but erroring on system stats.

Related errors


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