Nodes/Basic data handling/force calculation
ComfyUI Node

force calculation

Force ComfyUI to actually re-run its own graph

By StableLlama·Created about a year ago·Updated about 16 hours ago· 48
force calculation
  • value
  • value

ComfyUI has a caching problem, and you've almost certainly already met it: you drop a random-seed node into your graph, hit Queue, and the image comes out identical anyway. Or you replace an image in a folder on disk and the Load Image node stubbornly hands back the old one. That's ComfyUI's node cache - it only re-executes a node when it believes something upstream changed. ForceCalculation exists to break that belief on purpose.

What it does

It's the simplest node in the pack to describe: value goes in, the exact same value comes out, untouched. The magic is invisible. The source marks the node as an output node (OUTPUT_NODE = True) and its IS_CHANGED method returns a value that is never equal to anything - literally float("NaN"), which isn't even equal to itself. ComfyUI sees "this terminal node has fresh output every run," stops trusting the cached results of the branch feeding it, and recomputes.

When you actually need it

The honest answer is: rarely. That's why it's a "buy the pack, use the node twice a year" kind of thing. Real use cases:

  • A random or seed-generating node that ComfyUI doesn't detect as changed, so runs come out byte-identical.
  • A file-reading node where you've swapped the file on disk and the workflow keeps serving the stale one.
  • Debugging: you edited an upstream node's dependencies and ComfyUI's cache refuses to notice.

If you want proof it fired, don't wire it into your main output - wire its output into a show-text node and watch the value come through on every queue.

Inputs and outputs

Whole schema, both sides: one value input and one value output, both the wildcard * type, so you can pass literally anything through - a latent, an image, a string, a dict. There is nothing else to set.

Install

Part of the Basic data handling pack, and one of the easier custom-node installs you'll ever do. Open ComfyUI Manager, search "Basic data handling", install, restart. Or by hand:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

then restart ComfyUI - a real restart, not a browser refresh. The pack is pure Python with zero runtime dependencies, so this won't touch your pip environment or download any models.

Gotchas

Because it's marked as an output node, ComfyUI treats it as a terminal point in the graph - wire it somewhere you're actually using, or it can drag extra nodes into the run. And it only forces recalculation of the branch upstream of it, not the whole workflow. Hook it onto the random seed, not onto the entire SDXL pipeline, and you'll get fresh runs without re-executing everything.

CategoryBasic/flow control

Inputs (1)

NameTypeDefaultDescription
value*

Outputs (1)

NameTypeDescription
value*