Nodes/ComfyUI 1hewNodes/Any Empty Bool
ComfyUI Node

Any Empty Bool

'Is there actually anything here?' — the empty-checker for any type

By 1hew·Created about a year ago·Updated 7 days ago· 33
Any Empty Bool
  • any
  • bool

ComfyUI nodes are happiest when every input is connected and populated, and real workflows are full of inputs that arrive empty. A mask that came from a detection run with nothing detected. A prompt string that's blank. A batch that's zero frames. Any Empty Bool (1hew_AnyEmptyBool) answers one question - is this thing empty? - and answers it for any type of input, returning a plain BOOLEAN.

It's the boolean-output member of the pack's 1hewNodes/logic group, sitting next to its integer twin Any Empty Int. The use case is guard logic: check whether an input has real content, then route the graph accordingly before something downstream explodes on a zero-size tensor.

How it works

The emptiness rules are the interesting part, and they're saner than you'd expect from a "does anything count as empty" utility:

  • None → empty.
  • Empty or whitespace-only string → empty.
  • False or 0 → empty (a deliberate choice - this treats falsy as empty).
  • A tensor/array that's zero-sized or all zeros → empty. This is the big one: a "no detections" mask is often a zero-filled tensor, and this catches it.
  • An empty list, dict, or a list whose items are all empty → empty.

Everything else is non-empty. The output is True when empty, False when not - so wire it as-is into a switch, or think of it as "empty = true" for guard conditions.

Inputs and outputs

  • any (optional, any type) - the thing you're checking.
  • bool - True if empty, False otherwise.

Installing it

It's part of the 1hewNodes pack:

cd ComfyUI/custom_nodes
git clone https://github.com/1hew/ComfyUI-1hewNodes

or via ComfyUI Manager ("1hewNodes"), then restart. No models, no downloads.

The pattern it enables

Pair it with the pack's Any Switch Bool and you get a clean empty-guard: Detect Yolo mask → Any Empty Bool → switch that routes an "inpaint with the mask" branch or an "no mask, do nothing" branch. That's the workflow version of defensive programming, and it'll save you from a whole class of "shape mismatch" errors where a detection found nothing.

Two caveats worth knowing. First, the falsy-as-empty rule means 0 and False are "empty" - if your pipeline treats 0 as a legitimate value (a frame index of zero!), don't route through this node, use a comparison instead. Second, there's no invert toggle; if you want "is not empty," either swap your switch branches or use the Any Empty Int sibling and map empty→0 / not-empty→1. Small node, but it closes a real gap in the graph.

Category1hewNodes/logic

Inputs (1)

NameTypeDefaultDescription
anyopt*

Outputs (1)

NameTypeDescription
boolBOOLEAN