{"record":{"id":"4cb69919e256b7c5","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":"warning","filePath":"packages/stage-pages/src/pages/settings/providers/artistry/comfyui.vue","lineNumber":69,"sourceCode":"      const result = await invokeTestComfyUIConnection({\n        url: comfyuiServerUrl.value,\n      })\n      if (result.ok) {\n        connectionInfo.value = result.info || t('settings.pages.providers.provider.comfyui.settings.connection.connected')\n        connectionStatus.value = 'connected'\n      }\n      else {\n        connectionInfo.value = result.info || t('settings.pages.providers.provider.comfyui.settings.connection.failed')\n        connectionStatus.value = 'failed'\n      }\n    }\n    else {\n      // Browser fallback (subject to CORS)\n      const url = comfyuiServerUrl.value.replace(/\\/+$/, '')\n      const resp = await fetch(`${url}/system_stats`, { mode: 'cors' })\n\n      if (!resp.ok)\n        throw new Error(`HTTP ${resp.status}`)\n\n      const data = await resp.json() as { devices?: Array<{ name?: string }> }\n      const gpus = data.devices?.map(d => d.name).join(', ') || t('settings.pages.providers.provider.comfyui.settings.connection.unknown_gpu')\n      connectionInfo.value = `${t('settings.pages.providers.provider.comfyui.settings.connection.connected')} — ${gpus}`\n      connectionStatus.value = 'connected'\n    }\n  }\n  catch (e: unknown) {\n    const errorMessage = errorMessageFrom(e) ?? t('settings.pages.providers.provider.comfyui.settings.connection.unknown_error')\n    connectionInfo.value = `${t('settings.pages.providers.provider.comfyui.settings.connection.error_prefix')}: ${errorMessage}`\n    connectionStatus.value = 'failed'\n    if (errorMessage.includes('fetch') || errorMessage.includes('CORS')) {\n      isCorsError.value = true\n    }\n  }\n}\n\n// --- Workflow Manager ---","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/stage-pages/src/pages/settings/providers/artistry/comfyui.vue#L51-L87","documentation":"Browser-mode connection test fetches `${url}/system_stats` with mode: 'cors' and throws on any non-OK status. ComfyUI commonly returns 403 when started without --cors-allow-origins for the app origin; other codes indicate a wrong port/path or an authenticating proxy. Network-level failures (refused, DNS, CORS) surface separately as a fetch TypeError, which the catch below classifies via isCorsError.","triggerScenarios":"ComfyUI running without CORS flags; URL with wrong port or path (404); a reverse proxy returning 401/502; an older ComfyUI build without /system_stats.","commonSituations":"Testing stage-web against a local or remote ComfyUI from the browser instead of the Electron app; ComfyUI defaults not allowing the app origin.","solutions":["Restart ComfyUI with --cors-allow-origins matching the app origin (or '*' for local testing).","Verify the URL/port and that /system_stats responds (curl it from the same machine).","Prefer the Electron app, whose main-process proxy bypasses CORS entirely.","Check the isCorsError branch for the distinct network/CORS TypeError case."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const url = comfyuiServerUrl.value.replace(/\\/+$/, '')\nif (!/^https?:\\/\\//.test(url)) {\n  connectionInfo.value = 'Enter a valid http(s) URL'\n  connectionStatus.value = 'failed'\n  return\n}","typeGuard":null,"tryCatchPattern":"catch (e) {\n  const msg = errorMessageFrom(e) ?? ''\n  if (msg.startsWith('HTTP '))\n    connectionInfo.value = `ComfyUI returned ${msg} — check CORS flags and URL`\n  else if (msg.includes('fetch') || msg.includes('CORS'))\n    isCorsError.value = true\n  connectionStatus.value = 'failed'\n}","preventionTips":["Document the required ComfyUI CORS flags next to the URL field.","Default to the Electron proxy path whenever it is available.","Distinguish HTTP status failures from network/CORS TypeErrors in the message."],"tags":["comfyui","http","cors","connection-test","artistry"],"backgroundTag":"http-error-response","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}