fix: guard against KeyError on unregistered class_type in _is_intermediate_output#13552
fix: guard against KeyError on unregistered class_type in _is_intermediate_output#13552cest-la-v wants to merge 3 commits intoComfy-Org:masterfrom
Conversation
Commit 3696c5b 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.
📝 WalkthroughWalkthroughThe 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
_is_intermediate_output(introduced in 3696c5b) iterates over all node IDs in the prompt after execution, including orphaned/disconnected nodes that were never validated or executed. If any such node'sclass_typeis absent fromNODE_CLASS_MAPPINGS(e.g. a custom node pack that failed to load, was renamed, or was removed), the direct dict lookup raisesKeyError.This exception short-circuits the
while...elseblock and prevents:execution_successfrom being sent to the frontendself.history_resultfrom being assignedImages are still saved to disk (since
SaveImageruns during the main execution loop), but the Gallery never receives the success event and/historyreturns incomplete data — a silent failure that is hard to diagnose.Fix
Replace
NODE_CLASS_MAPPINGS[class_type]with.get(class_type)and guard onNone, so unregistered nodes are silently treated as non-intermediate-output nodes and execution continues normally.