IntSelector
A first-non-empty switch for numbers (and the zero that bites you)
- INT
IntSelector takes two optional INT inputs and outputs whichever one is present. No selector widget, no boolean, nothing to click - you wire a number in, and if a second one is also wired, the first wins.
That shape has one job, and it's a job ComfyUI workflows need constantly: let a branch be optional. You have a workflow whose steps come from a config file most of the time, but sometimes you want to override them by hand. Wire the config into primary and your manual override node into secondary, or just leave one of them unconnected and let the graph sort it out. If you've read anything about fallback switches, this is the value-node version of the same pattern - the plumbing-layer answer to "which of these two sources is live?"
How it works
def select(self, primary: int | None = None, secondary: int | None = None):
return (primary or secondary,)
Both inputs are optional, and an unconnected optional input arrives as None - the engine simply doesn't pass it. So an unwired primary makes secondary the winner.
Now the catch, because there is one and it's a real one: or is Python truthiness, not a null check. 0 is falsy. Wire 0 into primary and the node hands you secondary instead - or, if secondary is also unwired, None, which then travels into whatever integer input you aimed it at. A seed of 0, a steps of 0, a cfg of 0 (which is a perfectly normal value in 2026, plenty of distilled models run at CFG 1 off a default of 0), all of them can be swallowed.
Practical rule: treat primary as "the value, if it's non-zero" and remember that this node cannot distinguish "meaningfully zero" from "not connected."
Inputs and outputs
primary and secondary, both INT, both optional, both forceInput - so neither has a typed-in widget to fall back on, and it's a wire or nothing. One INT output.
Install
Manager search for the pack, or:
cd ComfyUI/custom_nodes
git clone https://github.com/morino-kumasan/comfyui-toml-prompt
then restart ComfyUI. Zero dependencies - the repo's requirements.txt is empty. If you follow the README's install block verbatim you'll clone the pack's old comfyui-utils name over SSH and get nowhere; the HTTPS URL above is the one that works.
Where people get burned
The zero case above. It's the number one reason this node surprises people. If your value can legitimately be 0 and you need it, use a different switch or make the 0 explicit somewhere upstream.
Both inputs unwired. You get None on an INT output. Nothing complains at validation time; the failure shows up as a downstream error about a missing value, several nodes away from the cause.
Expecting it to pick at random or by index. It doesn't. There's no selector. If you want "run A or run B, chosen by a value," that's a real A/B switch node or a boolean gate - this is only first-non-empty fallback.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| primaryopt | INT | 0–18446744073709550000 | — |
| secondaryopt | INT | 0–18446744073709550000 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| INT | INT | INT not disabled. |