Nodes/ComfyUI-SBTools/Variable Debug (SBTools)
ComfyUI Node

Variable Debug (SBTools)

Variable Debug (SBTools)

By Amatsukast·Created 4 months ago·Updated 10 days ago· 1
Variable Debug (SBTools)
  • var_list
  • COMBINATIONS
  • TOTAL
max_display100
show_totalfalse

ComfyUI's whole party trick is batched prompt variations - you build a graph and let it grind out a hundred different prompts without touching the UI. The SBTools variable system (Variable Prompt → Variable Combiner → Variable Builder) is one way to set that up, and its conditional syntax is genuinely clever. It's also the kind of clever you will get wrong: one misplaced bracket, and all 180 prompts in your batch resolve to the same wrong thing. Variable Debug is the "print before you render" checkpoint that catches that.

It does exactly two things: list the first N combinations your variable chain can produce, and (if you ask) count them all. It's the node you hang off a var_list connection while you're still building, so you can see what [man&&!young] --only actually did before you spend an hour waiting on a sampler.

Why it exists

Until SBTools 2.0.0 (July 2026), combination counting lived on Variable Builder as MAX_COMBINATIONS/ALL_COMBINATIONS - and it ran on every execution whether anything was connected to it or not. The author split it into this node for the obvious reason: now you only pay for the count when you want it, and because Variable Debug takes nothing but var_list, ComfyUI caches it. Change seed or index on the Builder all day - this node doesn't re-run. Edit the variables themselves, and it does. That cache behavior is the whole reason the node is worth keeping permanently in a workflow: it's free once you stop fiddling.

What you actually set

The node is a glorified two-knob inspection panel, and honestly that's the right shape for it:

  • var_list - the one wire. Feed it from any Variable Prompt, Variable Folder, Variable Image Loader, or Variable Combiner. You can also tap it mid-way through a Combiner tree to see what's resolved at that point in the chain, which is a great way to debug which combiner is dropping a variable.
  • max_display (INT, default 100) - how many combinations to list. Enumeration stops there, so this is the cost; a huge graph doesn't slow down just because it's huge. Set it to 0 and you skip the listing entirely, keeping only the total.
  • show_total (BOOLEAN, default off) - the expensive one. Counting the full cross-product of a big conditional graph can balloon, so it's capped at 100,000; anything past that reports as 100,000+. Leave it off until you actually need the number.

Random and ConditionalRandom variables show up in the listing as [RANDOM: choice1|choice2|...] rather than expanding into separate combinations - so a graph where everything is Random resolves to exactly one combination. Not a bug; that's how it's designed to read.

Outputs and where they go

  • COMBINATIONS (STRING) - the listing, which starts with a header (total, variable count, mode breakdown) followed by the enumerated combos. The node deliberately isn't an output node - it renders nothing on the canvas - so wire this into a Show Text / text preview node to actually read it.
  • TOTAL (INT) - the combination count, or 0 when show_total is off. Easy to misread as "zero", so remember: 0 means not counted, not no combinations. Feed it to a number display if you want it visible.

Installing it

Same as any node: ComfyUI Manager → Custom Nodes Manager → search ComfyUI-SBTools → Install → restart. Or by hand:

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

One honest caveat: requirements.txt pulls kornia and huggingface_hub, which the variable system itself never touches - they're for the pack's image side (BiRefNet background removal, match-color nodes). If you're here purely for the prompt/variable nodes, they run on the torch/PIL ComfyUI already ships, so you can skip the pip step entirely. Manager installs the pack anyway, so it mostly doesn't matter.

Where people get burned

  • TOTAL reads 0 when you forgot show_total. It's off by default by design - flip it on.
  • Old workflows break: if you're loading a pre-2.0.0 graph that expected MAX_COMBINATIONS off Variable Builder, that output is gone. Add this node instead.
  • Nothing changes when you tweak the seed - that's the cache, not a bug. Edit a variable if you want it to recompute.
  • (no variables connected) is the honest output when you forgot to wire var_list; you'll know immediately.

It's a boring node on purpose. The payoff is not having to stare at 180 bad renders to figure out which condition you typo'd.

CategorySBTools/Prompt

Inputs (3)

NameTypeDefaultDescription
max_displayINT1000–10000How many combinations to list. Enumeration stops there, so this is also the cost - a large graph is unaffected by its own size.
show_totalBOOLEANfalseCount the total number of combinations. Off by default: this is the expensive part, and on a large conditional graph the exact number is unreachable anyway (counting stops at 100,000).
var_listoptVARIABLE_LISTVariable list from Variable Prompt, Variable Folder, Variable Image Loader, or Variable Combiner

Outputs (2)

NameTypeDescription
COMBINATIONSSTRING
TOTALINT