Require String Before Image
Make ComfyUI Wait Until a String Is Ready Before It Touches Your Image
- image
- image
ComfyUI executes nodes in dependency order, and usually that's all you need. But sometimes a node that produces a string - a file write, an API call, a prompt composer with side effects - needs to finish before a downstream node touches your image, even though nothing data-wise connects them. Require String Before Image is a barrier for exactly that: it takes an IMAGE and a control string, returns the image unchanged, and - here's the trick - takes the string as a hard dependency, so ComfyUI is forced to run the string's producer first.
It's from artyclaw/artyclaw-comfy, and it's a genuinely subtle piece of workflow plumbing. People who've fought ComfyUI's ordering will recognize the pattern immediately: you can't wire a string into an image pipeline without changing the data, so you need a node that adds the dependency without touching the data.
How it works
The mechanism is almost comedically simple, and it's exactly right. The node's apply method does _ = control_text - it reads the control string, which establishes the execution dependency, then returns the image untouched. In ComfyUI's graph model, execution order is derived from data flow: if node B consumes node A's output, A runs first. By consuming the control string, this node forces its producer to complete before the image passes through. The image itself is never modified - it's a pure pass-through wrapped in an ordering constraint.
The display name says it all: "Require String Before Image." The string is the gate; the image is the cargo.
Inputs and output
- control_text - the STRING whose producer you want to finish first. Wire it from the node that must run early.
- image - the IMAGE to pass through.
One output, image, identical to the input. Chain it wherever you need to guarantee ordering: the string's producer could be a text-file writer, a wildcard resolver, an API-calling node - anything with side effects you want completed before the image continues downstream.
Install
ComfyUI Manager → search ArtyClaw Comfy Nodes, or:
cd ComfyUI/custom_nodes
git clone https://github.com/artyclaw/artyclaw-comfy
Restart. No dependencies.
Where people get burned
The most common mistake is expecting the node to use the string - it doesn't, it only waits on it. If you want the string's value somewhere downstream, you still need to wire it there separately; this node adds timing, not data. Second, the barrier only helps if the string's producer is actually upstream in the graph - if nothing produces that string, the dependency is on a widget and it does nothing. Third, remember ComfyUI's caching: if the control string's node doesn't re-run, neither does anything downstream of this barrier, which is usually what you want but can look like "it's stuck" during iteration. It's the kind of node that solves a maddening problem and then becomes invisible - which is the best compliment a plumbing node can get.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| control_text | STRING | — | |
| image | IMAGE | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| image | IMAGE | — |