fix: a failed ComfyUI run is reported as a successful image generation with no images (#33237)

This commit is contained in:
G30 2026-10-27 13:21:01 -04:00 • committed by GitHub
parent 1ae310b622
commit d1ae9e75e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -87,6 +87,13 @@ async def _ws_get_images(ws, workflow, client_id, base_url, api_key):
# binary messages (previews) are silently skipped
history = (await get_history(prompt_id, base_url, api_key))[prompt_id]
status = history.get('status', {})
if status.get('status_str') == 'error':
error = next((data for kind, data in status.get('messages', []) if kind == 'execution_error'), {})
raise Exception(
f'ComfyUI {error.get("node_type", "workflow")} failed: {error.get("exception_message", "").strip()}'
)
for node_id in history['outputs']:
node_output = history['outputs'][node_id]
if node_id in workflow and workflow[node_id].get('class_type') in [