update
Merge two dicts and know exactly who wins the tie
- dict1
- dict2
- DICT
If you've ever built a config dict in one place and a set of overrides in another and wished there were a one-node way to combine them, this is it. update (Basic data handling: DictUpdate) merges two dictionaries and returns the result - with a clearly defined rule for what happens when both sides claim the same key.
Two required inputs:
- dict1 - the base DICT
- dict2 - the DICT to merge in
and one output, the merged DICT.
Mechanically it's Python's dict.update(): result = dict(dict1); result.update(dict2). All of dict1's keys survive, every key in dict2 is added, and when a key exists in both, dict2 wins - the value from the second dict replaces the first. Order matters, and it matters on purpose: feed your base defaults in as dict1 and your overrides in as dict2 and you get "base, unless overridden."
When you'd reach for this
This is the workhorse of "layer user settings over defaults" workflows. Keep a clean default dict, build a smaller dict of the values that actually changed (via DictSet), and run update - the output is a fully resolved dict you can read back with DictGet. It also beats DictSet when you have a whole batch of keys to patch at once; one merge replaces five set-nodes.
Two small behaviors worth knowing. The source has a shortcut: if dict2 is empty, it returns dict1 untouched (which is what you'd want anyway). And like the rest of this pack's dict nodes, it doesn't mutate either input - you get a new dict, so both sources stay valid for other branches.
Installing it
This node lives in the Basic data handling pack by StableLlama. In ComfyUI Manager, search "Basic data handling", install, restart. Or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
then restart. No dependencies, no requirements.txt, no models to download - it's plain Python with an empty declared dependency list.
Troubleshooting
The classic mistake is swapping the inputs and wondering why your base values stomp your overrides. Remember: dict2 wins. If you need a merge where the first dict should win on conflicts, either swap the wires or think again about whether you want that at all. And as always with this pack, DICT is a custom type, so both sockets only accept DICT from other pack nodes - that's not a bug, it's the type system.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| dict1 | DICT | — | |
| dict2 | DICT | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| DICT | DICT | — |