File Paths For Loop Ensure Execution
The anchor that stops your save nodes from being skipped
- passthrough_1
- passthrough_2
- passthrough_3
- passthrough_4
- passthrough_5
- passthrough
Here's a ComfyUI fact that bites everyone eventually: the engine doesn't run nodes just because you placed them. It caches aggressively and works backward from output nodes, re-executing only what it thinks it needs to reach the outputs. Side-effect nodes - save, write, export, anything that produces a file rather than a pixel - sit in a weird zone: if the graph decides their route doesn't affect the final output it thinks it needs, it can just… skip them. That's the problem "File Paths For Loop Ensure Execution" exists to solve, and it's one of the most useful little plumbing nodes in the ComfyUI-FilePathsFromFolder pack.
It's an anchor. You wire things into it, it holds them, and you wire its single output into the loop's End node so the whole route becomes something the graph can't prune. The name is doing its job: it ensures execution.
The inputs
Five optional inputs, all any-type (*), numbered passthrough_1 through passthrough_5. Any of them can carry anything - an image, a latent, a path, a string, whatever your save/export node outputs. Connect the nodes you need guaranteed up to five of them. Need more than five? The author's own docstring says the trick: chain multiple Ensure Execution nodes together, because each one can feed the next.
The output
passthrough- a single any-type output. Wire this toFile Paths For Loop End.passthrough, exactly as the README's wiring diagram shows. That connection is what "anchors" the route so it executes.
Mechanically, the node returns the first non-None input it finds (walking passthrough_1 through passthrough_5 in order), which is why it can accept all five as optional and still always have something to pass on. It's a first-non-null passthrough, the same shape as a fallback switch from the plumbing layer - nothing clever, just enough to make the graph take the route seriously.
When you actually need it
If you're running File Paths For Loop Start → processing → Save Image, with the loop closed through File Paths For Loop End, your Save Image is already an output node and will run on its own. The Ensure Execution node earns its keep when you have save/write/export nodes in the middle of the flow, or routes that don't obviously terminate in a preview/save output - a node that writes caption files, appends to a log, exports a video segment, sends a notification. Those are exactly the ones ComfyUI's backward cache loves to prune, and they're the ones the pack README calls out: "save/write/export nodes that you must run."
The honest rule of thumb: if it writes a file and the graph can't see that it matters, anchor it through this node. Wire its passthrough into the loop End's passthrough, and your loop now has a hard guarantee that every iteration's side effects happen.
Install
Same as the rest of the pack - it's all one repo:
cd path/to/ComfyUI/custom_nodes
git clone https://github.com/RockyHong/ComfyUI-FilePathsFromFolder.git
Restart ComfyUI, then find "File Paths For Loop Ensure Execution" in the menu. No dependencies, no models, pure stdlib Python, so install can't get more boring than this. If your save nodes are mysteriously not producing files inside a loop, this little anchor is very often the missing piece - and now you know why it's there.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| passthrough_1opt | * | — | |
| passthrough_2opt | * | — | |
| passthrough_3opt | * | — | |
| passthrough_4opt | * | — | |
| passthrough_5opt | * | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| passthrough | * | — |