Nodes/ComfyUI-YogurtNodes/IsEmpty (Yogurt Nodes)
ComfyUI Node

IsEmpty (Yogurt Nodes)

The tiny boolean check that keeps your workflows from derailing

By yogurt7771·Created 2 years ago·Updated 9 days ago· 1
IsEmpty (Yogurt Nodes)
  • data
  • is_empty

Some nodes win by being clever. IsEmpty wins by being boring - it checks whether a data structure is empty and hands you back a BOOLEAN. That's it. But in a node graph, a boolean is a lever: it's what you feed a Switch or a conditional path so the workflow does one thing when a list has results and a completely different thing when it's a dead end.

It's a logic node in the YogurtNodes pack (yogurt7771/ComfyUI-YogurtNodes), and it's one of those "of course it exists" utilities you don't appreciate until a workflow returns an empty list and your whole graph starts feeding nothing into loaders.

How it works

One input, one output. It takes data of any type and checks len(data) == 0. When len() doesn't apply - say someone wired in a None or a number - it falls back to data is None or data == "" or data == 0. So it handles the two cases you actually hit in ComfyUI: an empty collection (list, dict, string) and a null/nothing value.

The is_empty output is True when the thing is empty, False otherwise. Wire it into a Switch node, or into any node that takes a boolean, and your graph grows its first if-statement. The natural pairing in this pack: Glob Files can return an empty list when a folder has no matches - IsEmpty tells the rest of the graph "there's nothing here, take the fallback path" before a downstream node throws.

Inputs that matter

  • data - literally anything. A LIST, a DICT, a STRING, a number, None. That's the whole input list.

Output: is_empty, a BOOLEAN.

Install

Same as every node in the pack - ComfyUI Manager (search "YogurtNodes") or:

cd ComfyUI/custom_nodes
git clone https://github.com/yogurt7771/ComfyUI-YogurtNodes.git
cd ComfyUI-YogurtNodes
pip install -r requirements.txt

Restart, and look under Yogurt Nodes / Logic. No dependencies beyond what ComfyUI already has, no models, no keys.

Troubleshooting

There's not much to break here, but a couple of behaviors are worth knowing:

  • Empty string vs. whitespace. " " is not empty. If your downstream logic expects a blank prompt to short-circuit, a prompt full of spaces will pass right through. Trim before checking if that matters to you.
  • 0 counts as empty. The fallback treats 0 like None/"" when len() isn't applicable. If your data is a scalar and you care about 0 vs "nothing", this node isn't the right tool - but in practice, feeding a raw 0 into a graph node is the edge case, not the norm.
  • It's truthiness, not "has content". An empty list [] is empty, sure - but so is a dict with keys whose values are all None. If you need "does this have anything usable", that's a deeper check than this node does.

That's the whole story. Drop it in front of anything that can come back empty, branch on the boolean, and your workflows stop silently failing on empty inputs - they start doing something sensible instead.

CategoryYogurtNodes/Logic

Inputs (1)

NameTypeDefaultDescription
data*Data structure to check

Outputs (1)

NameTypeDescription
is_emptyBOOLEAN