List Deduplicator
Kill duplicate tags and keep the order
- input_list
- deduplicated_list
- count
- removed_count
Merge two prompt lists, join a few tag sources, or cycle a list through a workflow a couple of times, and duplicates accumulate fast. Feeding ["red", "blue", "red", "green"] into your prompt builder is a small waste; feeding 200 of them is the kind of thing that quietly ruins a batch. List Deduplicator is the sweep: it removes duplicates, preserves the first-seen order, and tells you exactly how many it threw away.
It's part of DebugPadawan's ComfyUI Essentials, a small MIT-licensed utility pack with a full family of list nodes. This is the cleanup crew.
How it works
The code walks the list once, keeping the first occurrence of each item and dropping later repeats. Order is preserved - the output is your original list minus the duplicates, not a reordering. Two outputs beyond the cleaned list give you the bookkeeping:
- count - how many unique items remain.
- removed_count - how many were dropped.
count + removed_countshould equal what you put in.
The gotcha: dedup is by string
Here's the detail that will bite you: the node compares items by their string representation, not their actual value. That means:
- The integer
1and the string"1"are treated as the same item - one of them gets dropped. - Two distinct objects that print the same way (like
1andTrue's bool... well,str(1)is"1"andstr(True)is"True", so those survive - but1and"1"do not).
For typical list content - strings, tags, prompts - this is exactly what you want. For numeric lists where type fidelity matters, it's worth knowing the collision rule exists.
Inputs and outputs
- input_list - the LIST to clean.
Outputs: deduplicated_list, count (INT), removed_count (INT).
Install
Standard custom-node fare:
cd ComfyUI/custom_nodes
git clone https://github.com/DebugPadawan/DebugPadawans-ComfyUI-Essentials.git
Restart ComfyUI, or install via ComfyUI Manager by searching "DebugPadawan". requirements.txt lists numpy, torch, and opencv-python - numpy and torch already ship with ComfyUI and the shipped code never imports cv2, so no heavy downloads, no model files, no API keys.
When to reach for it
Run this right after a List Merger in union or concatenate mode, or before feeding a big tag list into a prompt builder. If removed_count is large, that's a signal your upstream lists overlap more than you thought - worth knowing about your data, not just cleaning it.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| input_list | LIST | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| deduplicated_list | LIST | — |
| count | INT | — |
| removed_count | INT | — |