fix: guard against unregistered class_type in _is_intermediate_output

Commit 3696c5ba introduced _is_intermediate_output which iterates over
all node IDs in the prompt after execution, including orphan/disconnected
nodes that are never validated or executed. If any such node's class_type
is not in NODE_CLASS_MAPPINGS (e.g. a custom node pack that failed to
load or was renamed), NODE_CLASS_MAPPINGS[class_type] raises KeyError.

This exception short-circuits the while...else block, preventing:
- execution_success from being sent to the frontend
- self.history_result from being assigned

Images are still saved to disk since SaveImage runs during the main
execution loop, but the Gallery plugin never receives the success event
and the /history API returns incomplete data.

Fix: use .get() with a None guard so unregistered nodes are silently
treated as non-intermediate-output nodes.
This commit is contained in:
cest-la-v 2026-03-29 20:40:55 +08:00
parent 443074eee9
commit 4b672ff45b

View File

@ -413,7 +413,9 @@ def format_value(x):
def _is_intermediate_output(dynprompt, node_id):
class_type = dynprompt.get_node(node_id)["class_type"]
class_def = nodes.NODE_CLASS_MAPPINGS[class_type]
class_def = nodes.NODE_CLASS_MAPPINGS.get(class_type)
if class_def is None:
return False
return getattr(class_def, 'HAS_INTERMEDIATE_OUTPUT', False)
def _send_cached_ui(server, node_id, display_node_id, cached, prompt_id, ui_outputs):