When to use
- Changing node class names: You changed a node’s class name (use
DISPLAY_NAMEfor display name changes instead) - Merging nodes: Multiple nodes consolidated into one (e.g.,
Load3DAnimationmerged intoLoad3D) - Refactoring inputs: Input names or types changed between versions
- Fixing typos: Correcting node names without breaking existing workflows
Where to register replacements
Register replacements during your extension’son_load lifecycle hook. Create a dedicated file (e.g., node_replacements.py) in your custom node package:
Complete example
Here’s a full example showing how to structure node replacements in a custom node package:Core examples
ComfyUI core uses node replacements for built-in node migrations. Here are real examples fromcomfy_extras/nodes_replacements.py:
Simple node merge
WhenLoad3DAnimation was merged into Load3D:
Typo fix
Correcting a typo inSDV_img2vid_Conditioning → SVD_img2vid_Conditioning:
Input renaming with defaults
ReplacingImageScaleBy with ResizeImageMaskNode:
Autogrow input mapping
For nodes using Autogrow (dynamic inputs), use dot notation:NodeReplace parameters
| Parameter | Type | Description |
|---|---|---|
new_node_id | str | Class name of the replacement node |
old_node_id | str | Class name of the deprecated node |
old_widget_ids | list[str] | None | Ordered list binding widget IDs to their relative indexes |
input_mapping | list | None | How to map inputs from old to new node |
output_mapping | list | None | How to map outputs from old to new node |
Input mapping
Each input mapping entry defines how an input transfers from the old node to the new one. Map from old input:Output mapping
Output mappings use index-based references:Widget ID binding
Theold_widget_ids field maps widget IDs to their positional indexes. This is required because workflow JSON stores widget values by position, not ID.
REST API
Retrieve all registered replacements:Frontend behavior
When a workflow contains a deprecated node, the frontend:- Fetches replacements from
GET /api/node_replacements - Detects nodes matching
old_node_id - Prompts the user to upgrade
- Applies input/output mappings automatically
- Preserves connections and widget values