SillyTavern/SillyTavern · error · Error

ComfyUI returned an error.

Error message

ComfyUI returned an error.

What it means

Thrown (then surfaced as HTTP 500 with error.message) inside the ComfyUI /generate route when the POST to the ComfyUI /prompt endpoint returns a non-OK status. The original response body is attached as error.cause via tryParse(text), so the underlying ComfyUI error JSON travels with the Error but only the fixed string reaches the HTTP body.

Source

Thrown at src/endpoints/stable-diffusion.js:583

        const url = new URL(urlJoin(request.body.url, '/prompt'));

        const controller = new AbortController();
        request.socket.removeAllListeners('close');
        request.socket.on('close', function () {
            if (!response.writableEnded && !item) {
                const interruptUrl = new URL(urlJoin(request.body.url, '/interrupt'));
                fetch(interruptUrl, { method: 'POST', headers: { 'Authorization': getBasicAuthHeader(request.body.auth) } });
            }
            controller.abort();
        });

        const promptResult = await fetch(url, {
            method: 'POST',
            body: request.body.prompt,
        });
        if (!promptResult.ok) {
            const text = await promptResult.text();
            throw new Error('ComfyUI returned an error.', { cause: tryParse(text) });
        }

        /** @type {any} */
        const data = await promptResult.json();
        const id = data.prompt_id;
        const historyUrl = new URL(urlJoin(request.body.url, '/history'));
        while (true) {
            const result = await fetch(historyUrl);
            if (!result.ok) {
                throw new Error('ComfyUI returned an error.');
            }
            /** @type {any} */
            const history = await result.json();
            item = history[id];
            if (item) {
                break;
            }
            await delay(100);

View on GitHub (pinned to 8172dcd0ee)

Solutions

  1. Inspect error.cause (server log: console.error('ComfyUI error:', error)) for the exact ComfyUI response body.
  2. Validate the workflow JSON against the server's installed custom nodes and models before submitting.
  3. Confirm the ComfyUI base URL is reachable and, if behind basic auth, that auth is set correctly.
  4. Retry after freeing VRAM or reducing batch size if the cause indicates an OOM.

Example fix

// before
if (!promptResult.ok) {
  const text = await promptResult.text();
  throw new Error('ComfyUI returned an error.', { cause: tryParse(text) });
}
// after - surface status + body so the client can act
if (!promptResult.ok) {
  const text = await promptResult.text();
  throw new Error(`ComfyUI returned HTTP ${promptResult.status}.`, { cause: tryParse(text) ?? text });
}
Defensive patterns

Strategy: try-catch

Validate before calling

if (!isValidUrl(url)) throw new Error('Invalid ComfyUI URL');
if (typeof prompt !== 'object' || prompt === null) throw new Error('Prompt must be a workflow object');

Type guard

/** @param {unknown} p */
const isComfyPrompt = (p) => typeof p === 'string' || (typeof p === 'object' && p !== null);

Try / catch

try { const r = await comfyGenerate(url, prompt); }
catch (e) {
  const cause = e.cause;
  if (cause && cause.node_errors) handleWorkflowErrors(cause);
  else if (cause && cause.error) handleUpstreamError(cause);
  else handleNetwork(e);
}

Prevention

When it happens

Trigger: ComfyUI rejects the submitted prompt workflow JSON (invalid node, missing model, bad wiring) and returns 4xx/5xx on /prompt; the ComfyUI server URL is wrong so the proxy returns an error status; auth required by a reverse proxy and missing/invalid.

Common situations: Workflow exported from a newer ComfyUI than the server runs; referenced checkpoint/LoRA not installed on the server; URL field points to a ComfyUI behind basic auth without credentials; server out of VRAM and returning 500.

Related errors


AI-assisted analysis of SillyTavern/SillyTavern@8172dcd0ee (2026-08-13). Data as JSON: /api/errors/b3ee725f147c5c92. Report an issue: GitHub.