Modify Node ID
Change one node ID in a ComfyUI workflow without snapping its wires
- modified_workflow
Every node in ComfyUI carries an internal ID number, and for 99% of what you do it's invisible plumbing. Then you hit the 1%: you merged two workflows and they both contain a node 12, or you need a specific node to have a specific ID because you're addressing nodes through the API, and suddenly the number matters. Modify Node ID is the single-ID fix: paste a workflow, give it the old ID and the new ID, get back a corrected workflow.
The honest pitch: canvas first, JSON second
This pack actually has two ways to change one ID. On the canvas you right-click a node → "Change Node ID" (or select exactly one node and hit Ctrl/Cmd+I), type the new number, and it's applied instantly with links and group memberships updated - and it refuses if the ID is already taken. That's the tool for when the graph is in front of you.
The Modify Node ID node is for when the workflow lives as JSON instead - you got a .json file from someone, you're editing it as text, or you're preparing it for an API call. You can't right-click a downloaded file, so you feed the JSON through the node and it does the rename offline.
How it works
Three inputs:
workflow_json- the workflow, pasted (multiline) or loaded via the "Load Workflow" button the frontend adds.old_node_idandnew_node_id- the rename, as plain strings.
It also carries an optional id_mapping field, which makes it secretly able to do batch renames too - drop a full mapping in and it'll process all of them. So the real difference between this and Batch Modify Node IDs is convenience for the one-ID case; they share the same rename engine.
That engine auto-detects the two workflow formats - the API shape ({"10": {"inputs": ...}}, where node IDs are the dict keys) and the UI shape ({"nodes": [...], "links": [...]}) - and rewrites both. Link endpoints get updated (in a UI link array, positions 1 and 3 are the origin and target node IDs), groups too, and the result comes back as pretty-printed JSON in the single modified_workflow STRING output. A mapping that matches nothing just no-ops; invalid JSON earns you a {"error": ...} object rather than a crash.
Where people get burned
Two things, both inherited from the pack's shared rename engine. First, the recursion rewrites any string in the file that equals the old ID - including widget values, not just node IDs - so pick an old ID that doesn't appear as plain text in the workflow. Second, there's no duplicate-target check: if the new ID already exists, the JSON node won't warn you the way the canvas shortcut does. The canvas version guards against both; the JSON version trusts you. Back up first, especially on a workflow you can't re-download.
Installing it
Same as the rest of the pack - dependency-free, Python stdlib only, no models to fetch. ComfyUI Manager → search "Node ID Modifier", or:
cd ComfyUI/custom_nodes
git clone https://github.com/jjlwmy/comfyui-node-id-modifier
Restart ComfyUI; the node lives under utils → ID Tools. The whole pack is a young, single-commit MIT project, so treat it as a small utility rather than infrastructure - but for one-off ID fixes it's genuinely handy, and the Ctrl+I shortcut alone is worth the install.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| workflow_json | STRING | {} | — |
| old_node_id | STRING | — | |
| new_node_id | STRING | — | |
| id_mappingopt | STRING | {} | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| modified_workflow | STRING | — |