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 <noreply@anthropic.com>
This commit is contained in:
2026-04-09 18:34:10 +02:00
parent 831ed302e9
commit 9477777124
+14 -15
View File
@@ -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):