Comfy-Org/ComfyUI · error · ValueError

SeedVR2TemporalChunk: expected a 5-D video latent (B, C, T,

Error message

SeedVR2TemporalChunk: expected a 5-D video latent (B, C, T, H, W); got shape {tuple(samples.shape)}.

What it means

SeedVR2TemporalChunk.execute expects latent['samples'] to be a 5-D video latent (B, C, T, H, W). Any other rank — most commonly a 4-D image latent — raises this error echoing the shape so you can see which dimension is missing.

Source

Thrown at comfy_extras/nodes_seedvr.py:458

                                          io.DynamicCombo.Option("manual", [
                                              io.Int.Input("frames_per_chunk", default=21, min=1, max=16384, step=4,
                                                           tooltip="Pixel frames per temporal chunk (4n+1: 1, 5, 9, 13, ...)."),
                                          ]),
                                      ]),
            ],
            outputs=[
                io.Latent.Output(display_name="latents", is_output_list=True,
                                 tooltip="The temporal chunks in sequence order."),
                io.Int.Output(display_name="temporal_overlap",
                              tooltip="The effective latent-frame overlap between adjacent chunks, for Merge SeedVR2 Latents."),
            ],
        )

    @classmethod
    def execute(cls, latent, temporal_overlap, chunking_mode) -> io.NodeOutput:
        samples = latent["samples"]
        if samples.ndim != 5:
            raise ValueError(
                f"SeedVR2TemporalChunk: expected a 5-D video latent (B, C, T, H, W); "
                f"got shape {tuple(samples.shape)}."
            )
        if samples.shape[1] != SEEDVR2_LATENT_CHANNELS:
            raise ValueError(
                f"SeedVR2TemporalChunk: expected {SEEDVR2_LATENT_CHANNELS} latent channels; "
                f"got shape {tuple(samples.shape)}."
            )
        if temporal_overlap < 0:
            raise ValueError(
                f"SeedVR2TemporalChunk: temporal_overlap must be >= 0; got {temporal_overlap}."
            )
        mode = chunking_mode["chunking_mode"]
        if mode not in ("auto", "manual"):
            raise ValueError(
                f"SeedVR2TemporalChunk: chunking_mode must be 'auto' or 'manual'; "
                f"got {mode!r}."
            )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Feed a 5-D SeedVR2 video latent from the video VAE encode / SeedVR2 sampling chain.
  2. If a single-frame video latent lost its temporal dim, restore it: samples = samples.unsqueeze(2) so shape becomes (B, C, 1, H, W).
  3. Verify samples.ndim == 5 in the upstream node before outputting the latent.

Example fix

# before
samples = samples.squeeze(2)  # single frame collapsed to 4-D -> error

# after
if samples.ndim == 4:
    samples = samples.unsqueeze(2)  # restore (B, C, 1, H, W)
Defensive patterns

Strategy: type-guard

Validate before calling

samples = latent['samples']
if samples.ndim == 4:
    samples = samples.unsqueeze(2)  # restore temporal dim for 1-frame video latents
latent['samples'] = samples
assert samples.ndim == 5

Type guard

def is_5d_latent(samples) -> bool:
    return samples.ndim == 5

Prevention

When it happens

Trigger: Connecting a 4-D image latent (B, C, H, W) or a 3-D tensor to the Split/TemporalChunk node; or a custom node emitting a non-5-D 'latent' dict.

Common situations: Splitting an image-upscaled latent instead of a video latent; workflows copied from image pipelines without the video VAE encode; custom nodes that squeeze the temporal dim for single-frame videos.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/984100f7b2db1c43. Report an issue: GitHub.