mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-06 19:42:34 +08:00
fix: improve error message when node type is missing
- Change error type from 'invalid_prompt' to 'missing_node_type' for frontend detection - Add extra_info with node_id, class_type, and node_title (from _meta.title) - Improve user-facing message: 'Node X not found. The custom node may not be installed.' Fixes COM-12528 Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c0df1-aa57-72e0-8193-46aa24b5a327
This commit is contained in:
parent
3aace5c8dc
commit
0e40fb566e
24
execution.py
24
execution.py
@ -1000,22 +1000,34 @@ async def validate_prompt(prompt_id, prompt, partial_execution_list: Union[list[
|
|||||||
outputs = set()
|
outputs = set()
|
||||||
for x in prompt:
|
for x in prompt:
|
||||||
if 'class_type' not in prompt[x]:
|
if 'class_type' not in prompt[x]:
|
||||||
|
node_data = prompt[x]
|
||||||
|
node_title = node_data.get('_meta', {}).get('title')
|
||||||
error = {
|
error = {
|
||||||
"type": "invalid_prompt",
|
"type": "missing_node_type",
|
||||||
"message": "Cannot execute because a node is missing the class_type property.",
|
"message": f"Node '{node_title or f'ID #{x}'}' has no class_type. The workflow may be corrupted or a custom node is missing.",
|
||||||
"details": f"Node ID '#{x}'",
|
"details": f"Node ID '#{x}'",
|
||||||
"extra_info": {}
|
"extra_info": {
|
||||||
|
"node_id": x,
|
||||||
|
"class_type": None,
|
||||||
|
"node_title": node_title
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (False, error, [], {})
|
return (False, error, [], {})
|
||||||
|
|
||||||
class_type = prompt[x]['class_type']
|
class_type = prompt[x]['class_type']
|
||||||
class_ = nodes.NODE_CLASS_MAPPINGS.get(class_type, None)
|
class_ = nodes.NODE_CLASS_MAPPINGS.get(class_type, None)
|
||||||
if class_ is None:
|
if class_ is None:
|
||||||
|
node_data = prompt[x]
|
||||||
|
node_title = node_data.get('_meta', {}).get('title', class_type)
|
||||||
error = {
|
error = {
|
||||||
"type": "invalid_prompt",
|
"type": "missing_node_type",
|
||||||
"message": f"Cannot execute because node {class_type} does not exist.",
|
"message": f"Node '{node_title}' not found. The custom node may not be installed.",
|
||||||
"details": f"Node ID '#{x}'",
|
"details": f"Node ID '#{x}'",
|
||||||
"extra_info": {}
|
"extra_info": {
|
||||||
|
"node_id": x,
|
||||||
|
"class_type": class_type,
|
||||||
|
"node_title": node_title
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (False, error, [], {})
|
return (False, error, [], {})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user