ComfyUI Node

remove

Remove an item and get a straight answer about whether it was there

By StableLlama·Created about a year ago·Updated 4 days ago· 48
remove
  • set
  • item
  • set
  • success

remove takes an item out of a set and - this is the distinguishing feature - tells you whether it actually succeeded. It outputs the updated set and a success boolean. The display name is just "remove," but the hidden second output is what makes it worth choosing over its quieter sibling, discard.

Here's the division of labor in this pack: discard removes an item and never reports failure; remove removes an item and hands you a boolean so your workflow can react. That boolean is the whole reason to pick this node. Use it when "was this tag actually in the set?" changes what you do next - like verifying a required element was present before proceeding, or branching into an error path when a removal silently didn't happen. The set comes back non-destructively too, so the input stays usable elsewhere.

How it works

The mechanism is Python's set.remove() wrapped in a try/except. The node copies the input set, attempts to remove the item, and:

  • If the item was there, it returns (set_without_item, True).
  • If it wasn't, it returns the unchanged set with success = False - no error, no crash. The KeyError is caught internally.

That's the whole trick: the node converts Python's exception into a data output you can wire into if/else or flow select. It's the difference between a workflow that hard-fails and one that branches gracefully.

Inputs and output

  • set (SET) - the set to remove from.
  • item (ANY) - the item to remove. Must match by exact value: "3" and 3 are different.
  • set (SET, output) - the set with the item removed (or unchanged if absent).
  • success (BOOLEAN, output) - True if the item was actually present and removed.

Two outputs, and the success one is where you'll build your conditional logic.

Installing

It's part of Basic data handling by StableLlama. Install via ComfyUI Manager - search "Basic data handling" - or clone manually:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Restart ComfyUI after either route. Zero dependencies, no models - a clean, fast install typical of this pure-Python pack.

Common issues

The recurring gotcha is exact matching. If success keeps coming back False, the item isn't in the set as that exact value - case, whitespace, or int-vs-float differences will do it. Normalize both sides before comparing. And if you don't actually need the boolean, you're carrying an extra wire around for nothing - that's when discard is the cleaner choice.

CategoryBasic/SET

Inputs (2)

NameTypeDefaultDescription
setSET
item*

Outputs (2)

NameTypeDescription
setSET
successBOOLEAN