Fix ComfyUI Prompt Has No Outputs API Error
HTTP 400 Bad Request: {"error": {"type": "prompt_no_outputs", "message": "Prompt has no outputs"}} | Blank canvas on drag-and-drop Submitting a workflow JSON to http://127.0.0.1:8188/prompt fails with HTTP 400 "Prompt has no outputs", OR dragging an API-format JSON file into the ComfyUI web canvas shows a blank screen or silent import error.
Two distinct ComfyUI architecture rules: (1) ComfyUI /prompt builds its execution DAG backwards from sink nodes—so any graph missing a real output node (SaveImage, SaveVideo, PreviewImage) OR missing the outer {"prompt": ...} envelope executes zero nodes; (2) ComfyUI uses two incompatible JSON schemas—UI Format (canvas coordinates) vs API Format (flat node-ID dictionary).
Copy-Paste Verified Fix
# 1. Verify your JSON is API-format, contains a terminal output node, has zero dangling links, and queue properly wrapped in {"prompt": ...}
python3 -c '
import json, sys, urllib.request
g = json.load(open(sys.argv[1]))
assert "nodes" not in g, "This is UI-Format JSON! Re-export via Dev Mode -> Save (API Format)."
types = [n.get("class_type") for n in g.values() if isinstance(n, dict)]
assert any(t in ("SaveImage", "SaveVideo", "VHS_VideoCombine") for t in types), f"Missing output node! Found: {types}"
for nid, node in g.items():
for k, v in (node.get("inputs") or {}).items():
if isinstance(v, list) and len(v) == 2 and isinstance(v[0], str):
assert v[0] in g, f"Dangling link in node {nid}.{k} -> missing node {v[0]}"
req = urllib.request.Request(
"http://127.0.0.1:8188/prompt",
data=json.dumps({"prompt": g}).encode(),
headers={"Content-Type": "application/json"}
)
print(urllib.request.urlopen(req).read().decode())
' workflow.api.json Before vs. After (Broken Pattern vs. Verified Fix)
curl -X POST http://127.0.0.1:8188/prompt \
-H "Content-Type: application/json" \
-d @workflow.api.json # Fails with HTTP 400 "Prompt has no outputs"! python3 -c 'import json,sys,urllib.request; g=json.load(open(sys.argv[1])); print(urllib.request.urlopen(urllib.request.Request("http://127.0.0.1:8188/prompt", data=json.dumps({"prompt": g}).encode(), headers={"Content-Type":"application/json"})).read().decode())' workflow.api.json Why this works: Wrapping the flat node dictionary inside {"prompt": g} plus verifying a terminal SaveImage / SaveVideo node guarantees /prompt returns HTTP 200 with a valid prompt_id.
Why This Failure Happens in Real Pipelines
Unlike sequential scripts, ComfyUI evaluates workflows lazily starting strictly from terminal output nodes (OUTPUT_NODE = True in Python, such as SaveImage, SaveVideo, CreateVideo -> SaveVideo, or VHS_VideoCombine). If your graph ends at VAEDecode or KSampler without wiring decoded images into an output sink, ComfyUI validates the JSON cleanly and immediately rejects execution with prompt_no_outputs.
Equally common when copying headless API workflows is sending the flat node dictionary ({"1": {...}, "2": {...}}) directly as the HTTP POST body to /prompt instead of wrapping it inside {"prompt": <graph>}. Without the top-level "prompt" key, ComfyUI sees an empty node graph and emits the exact same "Prompt has no outputs" error. Finally, dragging an API-format JSON into the default browser canvas fails because standard drag-and-drop expects UI-layout JSON (nodes/links arrays)—to inspect API JSON visually in the browser, you must toggle Dev Mode ON and click Load (API Format).
Step-by-Step Resolution & Verification
- 01
Verify the graph is API Format and contains a terminal output node
Confirm the JSON has flat string node IDs ("1", "2", ...) and ends with SaveImage (stills) or SaveVideo / CreateVideo -> SaveVideo (video). Stopping at VAEDecode triggers "Prompt has no outputs" every time.
- 02
Wrap flat API JSON inside {"prompt": ...} when POSTing to /prompt
Posting raw node keys directly to http://127.0.0.1:8188/prompt without the outer "prompt" key causes ComfyUI to ignore every node.
- 03
Use Settings -> Enable Dev Mode Options -> Load (API Format) in browser UI
To inspect or edit any API-format JSON visually inside the ComfyUI browser interface, turn on Dev Mode Options first so the dedicated Load (API Format) button appears.
curl -s http://127.0.0.1:8188/queue | python3 -m json.tool {"queue_running": [[...]], "queue_pending": []} # And POST returns {"prompt_id": "...", "node_errors": {}} How to Prevent This Error From Recurring
Name files explicitly *.api.json vs *.ui.json across repositories
Suffixing every headless graph .api.json immediately prevents teammates from dragging API graphs blindly onto the browser canvas.
Run pre-flight node-link & sink validation in batch runner scripts
Validating SaveImage/SaveVideo presence and dangling ["nodeId", idx] links locally takes 2 milliseconds and prevents silent overnight batch failures.
Always check node_errors in the /prompt HTTP response
Verify node_errors is an empty object {} and that every model filename (ckpt_name, unet_name) matches files actually present inside ComfyUI/models/.
Troubleshooting FAQs
- How can I tell instantly whether a JSON file is ComfyUI UI Format or API Format?
- UI Format JSON has top-level "nodes": [...] and "links": [...] arrays with x/y canvas coordinates. API Format JSON is a flat dictionary keyed by node ID strings ("1", "2", "3") containing class_type and inputs.
- Does FramesField validate all its ComfyUI JSON downloads automatically?
- Yes. Every ComfyUI graph served from /raw/skills/ is checked on every build for valid JSON, zero dangling node links, and a real terminal SaveImage or SaveVideo node.
- Why did /prompt accept my JSON but fail immediately with a missing checkpoint error?
- Model filenames inside inputs (like unet_name or clip_name) must exactly match filenames downloaded inside ComfyUI/models/. Query http://127.0.0.1:8188/object_info/UNETLoader to list exact installed model strings.
- Can I pass a client_id alongside {"prompt": graph} for WebSocket progress tracking?
- Yes. Sending {"prompt": graph, "client_id": "batch-01"} lets your Python script subscribe to ws://127.0.0.1:8188/ws?clientId=batch-01 and stream live step-by-step progress.