Comfy-Org/ComfyUI · error · ValueError
SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent
Error message
SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent frames but chunk 0 has {first.shape[2]}; only the final chunk may be shorter. What it means
In SeedVR2TemporalMerge, every chunk except the last must have exactly the same number of latent frames T as chunk 0; only the final chunk may be shorter (tail of the video). The overlap blending between consecutive chunks assumes aligned chunk lengths, so a shorter middle chunk would misalign the overlap window.
Source
Thrown at comfy_extras/nodes_seedvr.py:558
if temporal_overlap < 0:
raise ValueError(
f"SeedVR2TemporalMerge: temporal_overlap must be >= 0; got {temporal_overlap}."
)
chunks = [entry["samples"] for entry in latents]
first = chunks[0]
if first.ndim != 5:
raise ValueError(
f"SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H, W); "
f"chunk 0 has shape {tuple(first.shape)}."
)
for i, chunk in enumerate(chunks[1:], start=1):
if chunk.shape[:2] != first.shape[:2] or chunk.shape[3:] != first.shape[3:]:
raise ValueError(
f"SeedVR2TemporalMerge: chunk {i} shape {tuple(chunk.shape)} does not "
f"match chunk 0 shape {tuple(first.shape)} outside the temporal axis."
)
if i < len(chunks) - 1 and chunk.shape[2] != first.shape[2]:
raise ValueError(
f"SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent frames but "
f"chunk 0 has {first.shape[2]}; only the final chunk may be shorter."
)
out = latents[0].copy()
out.pop("noise_mask", None)
if len(chunks) == 1:
out["samples"] = first
return io.NodeOutput(out)
if temporal_overlap == 0:
out["samples"] = torch.cat(chunks, dim=2)
return io.NodeOutput(out)
chunk_latent = first.shape[2]
step = chunk_latent - min(temporal_overlap, chunk_latent - 1)
t_total = step * (len(chunks) - 1) + chunks[-1].shape[2]
b, c, _, h, w = first.shapeView on GitHub (pinned to 1c6d8d45b3)
Solutions
- Regenerate the offending middle chunk with the same frame length as chunk 0
- Reorder the list so the short chunk is last
- Fix the upstream chunking script to only emit a partial chunk at the tail
Defensive patterns
Strategy: validation
Validate before calling
if any(c.shape[2] != chunks[0].shape[2] for c in chunks[1:-1]):
# move any short chunk to the end or regenerate it
chunks.sort(key=lambda c: c.shape[2] == chunks[0].shape[2], reverse=True) Prevention
- Chunk scripts should emit equal-length chunks plus at most one tail chunk
- Keep chunk order stable when collecting latents from parallel jobs
When it happens
Trigger: Passing a chunk list where a middle chunk was generated with a different length parameter — e.g. chunk 0 with length 81 and chunk 2 with length 41 — or reordering chunks so a short tail chunk ends up in the middle.
Common situations: Chunked video restoration where chunk length settings were changed between runs; manually assembling the latents list in the wrong order; a chunking script that emits a partial chunk anywhere but the end.
Related errors
- SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H
- SeedVR2TemporalMerge: chunk {i} shape {tuple(chunk.shape)} d
- SeedVR2 patch input temporal size must satisfy T % {t} == 1,
- SeedVR2Preprocess expected at least one frame.
- SeedVR2Preprocess failed to pad video length to 4n+1; got {v
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/8b3b82b16823de7a.
Report an issue: GitHub.