remove
Delete the first match — and know whether it worked
- list
- value
- list
- success
Remove by value, not by position
Here's the scenario: you have a LIST of prompts, and one specific prompt is blacklisted. You don't know where it sits in the list, you just want it gone. That's what this node is for. It takes a LIST and a value, removes the first occurrence of that value, and - the useful part - tells you whether it actually found anything.
This is the "remove by value" sibling to the pack's "pop" node, which removes by index. Pop knows where it's cutting; remove searches. Same family, different problem.
How it works
Under the hood it's Python's list.remove(value) wrapped in a node - a copy is made first, so your original LIST is never touched (consistent with the rest of the pack's list editors). The clever bit is the success output: if the value isn't in the list, Python's remove() throws ValueError, and instead of crashing the node returns the list unchanged with success=False. So you get an explicit signal instead of a red-bordered error box.
Remember: only the first occurrence is removed. If your list has the value three times, two copies survive. For "remove every occurrence," you'd need a filter - this pack has a "filter" family in the Data List section, but for LISTs this node is the straightforward tool.
Inputs and outputs
- list (LIST) - the list to clean.
- value (*) - the thing to find and remove. This is a wildcard input, so it'll accept an int, a string, whatever the list holds.
Outputs:
- list (LIST) - the list with the first match removed (or unchanged if not found).
- success (BOOLEAN) -
Trueif a match was removed,Falseif not.
That boolean is gold for control flow. Wire it into the pack's if/else nodes and you can route "removed successfully → do X, wasn't there → do Y" without any extra checking.
Installing it
Part of Basic data handling by StableLlama - the r/StableDiffusion regular whose model deep-dives (Flux Klein 9B, RealVisXL) outrank his code in fame. The pack is intentionally minimal: zero runtime dependencies in its pyproject, no models, no GPU work, nothing to go wrong at install time.
Install via ComfyUI Manager (search "Basic data handling") or:
cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling
Restart and find it under Basic/LIST.
Troubleshooting
The most common stumble is expecting all occurrences to vanish - they don't, only the first. And if you're matching a string, matching is exact: "dog" won't match "Dog" or "dog!". Trim and case-fold with the pack's string nodes first if your values are messy. Also note the value input matches by equality, so if your LIST holds non-string objects, you need to pass the actual object, not something that merely looks like it.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| list | LIST | — | |
| value | * | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| list | LIST | — |
| success | BOOLEAN | — |