Nodes/SAX Bridge/SAX Assert
ComfyUI Node

SAX Assert

The traffic cop your workflow never knew it needed

By so16tm·Created 6 months ago·Updated 3 months ago· 0
SAX Assert
  • value
    modenot_none
    labelassert
    expected

    Every ComfyUI user has stared at a broken output and wondered which node silently fed it garbage. SAX Assert is the node you drop into the middle of a graph to answer that question before the garbage spreads. Give it any value - a string, a number, a tensor, a dict - and it checks that value against a condition you pick, then fails the run with a clear error if the check fails. It's a assert statement wearing a node costume, and it's quietly one of the most useful things in the whole SAX_Bridge pack.

    This is the debugging node family's working muscle, paired with its sibling SAX Assert Pipe (which reaches inside a pipe instead of checking a bare value). Where the Debug Inspector just shows you what's inside a pipe, Assert acts on what it sees. You can park one after a prompt concat to verify the text actually expanded, or before a detailer to confirm the mask isn't empty, and stop hand-waving about whether the wiring is right.

    How it works

    You connect one input, value (it accepts any type), pick a mode, and optionally set expected. If the value doesn't match, the node marks itself FAIL in the UI and raises an error that stops the workflow - colored border green for PASS, red for FAIL, orange if the check itself blew up. The label field is just a name that shows up in that status text, so when a graph has three asserts you can tell which one fired.

    The mode dropdown is where the real range lives: not_none and is_none for existence checks, equals/not_equals, contains/not_contains for strings, matches for regex, greater_than/less_than, in_range (write it as "min,max"), startswith/endswith, length_equals, has_key for dicts, and even shape_equals (format "B,C,H,W") for tensor shapes. The expected box auto-parses whatever you type - integers, floats, booleans, null, comma-separated lists - so you don't fuss with quoting.

    What you'll actually use

    • not_none on an optional input you're nervous about. The classic guard.
    • equals after a node that's supposed to output a fixed value, like a steps override that should be 20.
    • shape_equals right after a VAE decode, to confirm you got (1, 512, 512, 3) and not a weird batch you'll only notice two nodes later.

    That last one is the sleeper. ComfyUI's * wildcard inputs (see the plumbing notes in the KB) happily pass anything, and a shape mismatch is the kind of failure that surfaces as a confusing error far downstream. Assert catches it at the source.

    Installing and using

    You get this with the whole pack, no extra dependencies:

    cd ComfyUI/custom_nodes
    git clone https://github.com/so16tm/SAX_Bridge
    

    Restart ComfyUI, then right-click → Add Node → SAX/Bridge/Debug → SAX Assert. The node has no outputs - it's a terminal check, so wire it wherever you want to inspect, not in the middle of the flow. If you don't want a hard stop, don't use it on a branch you're actively iterating on; a failure that kills the whole run mid-experiment is by design, and sometimes that's exactly the point. Leave it in place as a permanent guard once the workflow is stable, and it'll quietly catch regressions when you rebuild the graph later.

    CategorySAX/Bridge/Debug

    Inputs (4)

    NameTypeDefaultDescription
    value*
    modeCOMBOnot_none16 options: not_none, is_none, equals, not_equals, contains, not_contains, +10
    labelSTRINGassert
    expectedoptSTRING

    Outputs (0)

    No outputs