Replicate Latents
Replicate Latents β the glue that makes batch prompting actually work
- latent
- LATENT
Batch prompting has a dirty secret: when you tell ComfyUI to process five prompts at once, the sampler needs the latents to match the batch size. If you're feeding in a single latent, everything breaks or silently runs at batch one. The Replicate Latents node from Endless-Nodes is the fix - it takes one latent and duplicates it N times so the tensor shapes line up.
It exists because of a specific workflow pattern. The Endless pack's batch prompt nodes (the SD, SDXL, and Flux Kontext ones) encode a pile of prompts into one big conditioning batch and run them all simultaneously on the GPU. For an img2img or Kontext-style edit, your input image produces exactly one latent - and one latent won't broadcast against a batch of twelve prompts. This node makes it twelve.
How it works
Two inputs, one output:
latent- the LATENT you want duplicated.count- INT, 1β64, default 1. This is how many copies you end up with.
Output: LATENT. The implementation is a tensor repeat: samples.repeat(count, 1, 1, 1), which clones the samples count times along the batch axis. It doesn't re-noise, doesn't vary anything, and doesn't resize - you get the same latent stacked count times. Set count to the number of prompts in your batch and the downstream sampler stops complaining about shape mismatches.
The gotcha is in that "same latent N times" bit. If your seed and everything downstream is also identical, you'll get N identical images - the whole point is that the prompts differ, so the same noise canvas produces N different results. It's duplication for batching, not variation. Leave count at its default of 1 and this node is a harmless no-op.
Installing it
It's part of the current Endless-Nodes pack, and it's one of the few nodes here that survived the June 2025 rebuild intact:
- ComfyUI Manager β Install Custom Nodes β search "Endless" / "Endless-Nodes".
- Or clone it in:
cd ComfyUI/custom_nodes
git clone https://github.com/tusharbhutt/Endless-Nodes
Restart ComfyUI after installing. No extra pip dependencies - the pack declares none at the top level.
Where people get burned
The most common failure is a LATENT shape mismatch error that names repeat or unsqueeze in the traceback. That's usually a count/prompt mismatch: you set count to the number of lines but your batch node grabbed a different count, or you have multiple replicate nodes feeding different batch sizes into the same sampler. Double-check that every replicate upstream of a sampler is set to the same value as the prompt batch. And if you're wiring this into a workflow from someone's shared image, keep it - it's genuinely load-bearing for the Kontext-style batch workflows the pack was built around.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| latent | LATENT | β | |
| count | INT | 11β64 | β |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| LATENT | LATENT | β |