Nodes/ComfyUI-EditUtils/EditUtils: Clear Ref Latents lrzjason
ComfyUI Node

EditUtils: Clear Ref Latents lrzjason

Keep Your Reference Images From Leaking Into the Wrong Wire

By lrzjason·Created 7 months ago·Updated 16 days ago· 207
EditUtils: Clear Ref Latents lrzjason
  • conditioning
  • conditioning

Here's the thing about EditUtils workflows: the reference images don't travel down a visible wire. They ride inside the conditioning object - attached as a reference_latents key that the EditApply nodes read through ComfyUI's extra_conds patch. That's elegant, but it means every conditioning output from an encode node is secretly carrying your refs with it. ClearRefLatents_EditUtils is the valve that strips them back out.

One input, one output, both CONDITIONING. The mechanism is a single call: it sets reference_latents to an empty list on the conditioning dict, leaving everything else - the text encoding, the pooled output, all of it - untouched. The refs are gone; the conditioning is otherwise exactly what it was.

Why would you want that? The README's use case is the clean one: you encoded text with reference images, but now you want to reuse that same text conditioning without the refs. Maybe the image is going to a different model or sampler that shouldn't see the reference. Maybe you're saving the conditioning to disk and want it portable. The most common real-world version of this is negative conditioning: a negative prompt that still carries a reference latent is a reference latent doing something you almost never intended on the negative side of a CFG contrast.

There's a subtler trap this node exists to rescue you from, and it bites everyone who builds a multi-branch EditUtils graph once. Because refs travel through the conditioning chain invisibly, it's easy to end up with reference latents attached to a conditioning you thought was a fresh text-only encode. If a sampler suddenly starts honoring images you didn't mean to include, that's your symptom, and ClearRefLatents is the surgical fix - it only touches the refs, unlike re-encoding the prompt from scratch.

One thing it won't do: it doesn't clear anything else. If you expected it to reset a mask or drop the pooled CLIP output, that's not this node. It's narrowly scoped, and the narrowness is the point - you slot it into a wire precisely when the refs are the problem, and the rest of the conditioning sails through.

Install is the standard pack step: ComfyUI Manager (search "EditUtils") or git clone https://github.com/lrzjason/ComfyUI-EditUtils into ComfyUI/custom_nodes, restart, and it'll be sitting in advanced/conditioning alongside the rest of lrzjason's edit utilities. No models, no dependencies - the only thing you need to understand is the conditioning chain, and if you've read the EditApply nodes in this pack you already do.

Categoryadvanced/conditioning

Inputs (1)

NameTypeDefaultDescription
conditioningCONDITIONING

Outputs (1)

NameTypeDescription
conditioningCONDITIONING