{"record":{"id":"e09d536309014e3b","repo":"SillyTavern/SillyTavern","slug":"comfyui-runpod-returned-an-error","errorCode":null,"errorMessage":"ComfyUI RunPod returned an error.","messagePattern":"ComfyUI RunPod returned an error\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"public/scripts/extensions/stable-diffusion/index.js","lineNumber":1477,"sourceCode":"        toastr.error(`Could not validate ComfyUI API: ${error.message}`);\n    }\n}\n\nasync function validateComfyRunPodUrl() {\n    try {\n        if (!extension_settings.sd.comfy_runpod_url) {\n            throw new Error('URL is not set.');\n        }\n\n        const result = await fetch('/api/sd/comfyrunpod/ping', {\n            method: 'POST',\n            headers: getRequestHeaders(),\n            body: JSON.stringify({\n                url: extension_settings.sd.comfy_runpod_url,\n            }),\n        });\n        if (!result.ok) {\n            throw new Error('ComfyUI RunPod returned an error.');\n        }\n\n        await loadSettingOptions();\n        toastr.success('ComfyUI RunPod API connected.');\n    } catch (error) {\n        toastr.error(`Could not validate ComfyUI RunPod API: ${error.message}`);\n    }\n}\n\nasync function onModelChange() {\n    const selectedModel = $('#sd_model').find(':selected');\n    extension_settings.sd.model = selectedModel.val();\n    saveSettingsDebounced();\n\n    if (extension_settings.sd.model && extension_settings.sd.source === sources.electronhub) {\n        const cachedModel = selectedModel.data('model');\n        const models = cachedModel ? [cachedModel] : await loadElectronHubModels();\n        ensureElectronHubQualitySelect(models);","sourceCodeStart":1459,"sourceCodeEnd":1495,"githubUrl":"https://github.com/SillyTavern/SillyTavern/blob/8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8/public/scripts/extensions/stable-diffusion/index.js#L1459-L1495","documentation":"Thrown by validateComfyRunPodUrl() when the POST to /api/sd/comfyrunpod/ping returns a non-2xx status. The server proxy pings the RunPod serverless ComfyUI endpoint. Catch surfaces 'Could not validate ComfyUI RunPod API: ComfyUI RunPod returned an error.'","triggerScenarios":"The RunPod serverless endpoint URL is wrong or the deployment is scaled to zero/cold-starting; the RunPod API key is missing or invalid server-side; the serverless payload template errors; network egress from the SillyTavern host to RunPod is blocked.","commonSituations":"RunPod serverless ID mistyped; endpoint paused/deleted; cold start timeout exceeded; missing server-side RUNPOD_API_KEY env var.","solutions":["Check the SillyTavern server console for the real upstream error returned by /api/sd/comfyrunpod/ping.","Confirm the RunPod serverless endpoint ID/URL is current and the deployment is running (check RunPod dashboard).","Verify the RUNPOD_API_KEY is set on the SillyTavern server and valid.","Retry once — serverless cold starts can fail the first ping."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function validateWithRetry(max = 2) {\n  for (let i = 0; i <= max; i++) {\n    try { await validateComfyRunPodUrl(); return; }\n    catch (e) {\n      if (i === max || /not set/i.test(e.message)) throw e;\n      await new Promise(r => setTimeout(r, 2000 * (i + 1))); // backoff for cold starts\n    }\n  }\n}","preventionTips":["Warm the RunPod serverless endpoint before validating (cold starts fail the first ping).","Confirm RUNPOD_API_KEY is set server-side.","Keep the deployment active in the RunPod dashboard."],"tags":["network","comfyui","runpod","http","serverless"],"backgroundTag":null,"analyzedSha":"8172dcd0ee672d3cd9a5e5f7af134f91a45cd2b8","analyzedAt":"2026-08-13T07:48:40.832Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}