{"record":{"id":"2fd3a261ffcd0dec","repo":"moeru-ai/airi","slug":"http-resp-status","errorCode":null,"errorMessage":"HTTP ${resp.status}","messagePattern":"HTTP \\$\\{resp\\.status\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/stage-tamagotchi/src/main/services/airi/widgets/artistry-bridge.ts","lineNumber":501,"sourceCode":"      // Update character-level defaults (volatile only)\n      cardDefaults.provider = payload.provider\n      cardDefaults.model = payload.model\n      cardDefaults.promptPrefix = payload.promptPrefix\n      cardDefaults.options = payload.options\n      cardDefaults.globals = payload.globals\n    })\n\n    defineInvokeHandler(params.context, artistryTestComfyUIConnection, async (payload) => {\n      log.log(`🔌 Testing ComfyUI connection at: ${payload.url}`)\n      try {\n        const url = payload.url.replace(/\\/+$/, '')\n        const controller = new AbortController()\n        const id = setTimeout(() => controller.abort(), 10000)\n        const resp = await fetch(`${url}/system_stats`, { signal: controller.signal })\n        clearTimeout(id)\n\n        if (!resp.ok)\n          throw new Error(`HTTP ${resp.status}`)\n        const data = await resp.json() as { devices?: Array<{ name?: string, vram_total?: number }> }\n        const gpus = data.devices?.map(d => d.name).join(', ') || 'Unknown GPU'\n        const vram = data.devices?.[0]?.vram_total\n        const vramStr = vram ? `${(vram / 1024 / 1024 / 1024).toFixed(1)} GB` : ''\n        return {\n          ok: true,\n          info: `Connected — ${gpus}${vramStr ? ` (${vramStr} VRAM)` : ''}`,\n        }\n      }\n      catch (e: unknown) {\n        const message = errorMessageFrom(e) ?? 'Unknown connection error'\n        log.error(`🔌 ComfyUI connection test failed: ${message}`)\n        return {\n          ok: false,\n          info: `Failed: ${message}`,\n        }\n      }\n    })","sourceCodeStart":483,"sourceCodeEnd":519,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/apps/stage-tamagotchi/src/main/services/airi/widgets/artistry-bridge.ts#L483-L519","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the URL points to a running ComfyUI instance and that /system_stats responds in a browser.","Check for a reverse proxy or auth layer intercepting the request and return the correct ComfyUI base URL.","Confirm the ComfyUI version exposes /system_stats (update or downgrade as needed).","Look at the HTTP status code in the error to pinpoint the layer returning it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function canReachComfyUI(url: string): Promise<boolean> {\n  try {\n    const resp = await fetch(`${url.replace(/\\/+$/, '')}/system_stats`, { signal: AbortSignal.timeout(10000) })\n    return resp.ok\n  } catch {\n    return false\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await testComfyUIConnection({ url })\n} catch (e) {\n  return { ok: false, info: `Connection failed: ${errorMessageFrom(e)}` }\n}","preventionTips":["Point the test URL at the ComfyUI API base (no auth proxy in front of /system_stats).","Run the test after starting ComfyUI and before saving the config.","Surface the HTTP status code in the UI so users can diagnose 401/404/500."],"tags":["comfyui","connection-test","network","artistry"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}