From 9477777124ce919c6f95c103565aba62899c7d1f Mon Sep 17 00:00:00 2001 From: Ethanfel Date: Thu, 9 Apr 2026 18:34:10 +0200 Subject: [PATCH] fix: scope input-scanning loop inside per-node try/except in extract_models_from_prompt If INPUT_TYPES() succeeded but returned a non-dict, the inner loop calling input_types.get() would raise AttributeError outside the guard, aborting model tracking for the entire prompt. Moving the loop inside the try/except means only the offending node is skipped via continue. Co-Authored-By: Claude Sonnet 4.6 --- mapper.py | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/mapper.py b/mapper.py index a42a2d6..8630bb7 100644 --- a/mapper.py +++ b/mapper.py @@ -159,24 +159,23 @@ class ModelMapper: try: input_types = node_cls.INPUT_TYPES() + for category in ("required", "optional"): + for input_name, input_def in input_types.get(category, {}).items(): + if not isinstance(input_def, (list, tuple)) or not input_def: + continue + # ComfyUI folder dropdowns have a list as their type + if not isinstance(input_def[0], list): + continue + value = node_inputs.get(input_name) + if not isinstance(value, str) or value in seen: + continue + model_type = self.get_model_type(value) + if model_type: + seen.add(value) + results.append((value, model_type)) except Exception: continue - for category in ("required", "optional"): - for input_name, input_def in input_types.get(category, {}).items(): - if not isinstance(input_def, (list, tuple)) or not input_def: - continue - # ComfyUI folder dropdowns have a list as their type - if not isinstance(input_def[0], list): - continue - value = node_inputs.get(input_name) - if not isinstance(value, str) or value in seen: - continue - model_type = self.get_model_type(value) - if model_type: - seen.add(value) - results.append((value, model_type)) - return results def invalidate(self):