Comfy-Org/ComfyUI · error · ValueError

SeedVR2Conditioning expects SeedVR2 VAE latents in Comfy cha

Error message

SeedVR2Conditioning expects SeedVR2 VAE latents in Comfy channel-first layout (B, {SEEDVR2_LATENT_CHANNELS}, T, H, W); got channel-last shape {tuple(vae_conditioning.shape)}.

What it means

After the 5-D check, SeedVR2Conditioning verifies the channel count is 16 (SEEDVR2_LATENT_CHANNELS) in dim 1. If instead the last dim equals 16, the code recognizes the classic channel-last mistake and raises this more specific error telling you the latent is channel-last rather than channel-first.

Source

Thrown at comfy_extras/nodes_seedvr.py:393

            ],
            outputs=[
                io.Conditioning.Output(display_name="positive", tooltip="The positive conditioning for sampling."),
                io.Conditioning.Output(display_name="negative", tooltip="The negative conditioning for sampling."),
            ],
        )

    @classmethod
    def execute(cls, model, vae_conditioning) -> io.NodeOutput:

        vae_conditioning = vae_conditioning["samples"]
        if vae_conditioning.ndim != 5:
            raise ValueError(
                "SeedVR2Conditioning expects a 5-D VAE latent in Comfy "
                f"channel-first layout; got shape {tuple(vae_conditioning.shape)}."
            )
        if vae_conditioning.shape[1] != SEEDVR2_LATENT_CHANNELS:
            if vae_conditioning.shape[-1] == SEEDVR2_LATENT_CHANNELS:
                raise ValueError(
                    "SeedVR2Conditioning expects SeedVR2 VAE latents in Comfy "
                    f"channel-first layout (B, {SEEDVR2_LATENT_CHANNELS}, T, H, W); "
                    f"got channel-last shape {tuple(vae_conditioning.shape)}."
                )
            raise ValueError(
                "SeedVR2Conditioning expects SeedVR2 VAE latents with "
                f"{SEEDVR2_LATENT_CHANNELS} channels; got shape {tuple(vae_conditioning.shape)}."
            )
        vae_conditioning = vae_conditioning.movedim(1, -1).contiguous()
        model = _resolve_seedvr2_diffusion_model(model)
        pos_cond = model.positive_conditioning
        neg_cond = model.negative_conditioning

        mask = vae_conditioning.new_ones(vae_conditioning.shape[:-1] + (1,))
        condition = torch.cat((vae_conditioning, mask), dim=-1)
        condition = condition.movedim(-1, 1)

        negative = [[neg_cond.unsqueeze(0), {"condition": condition}]]

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Convert the latent to channel-first: latent = latent.movedim(-1, 1).contiguous() before feeding the node.
  2. Prefer using Comfy's own SeedVR2 VAE encode nodes, which already emit channel-first latents.
  3. In custom nodes, normalize to (B, C, T, H, W) at the boundary instead of passing raw upstream layouts through.

Example fix

# before
vae_conditioning = {'samples': raw_seedvr_latent}  # (B, T, H, W, 16)

# after
vae_conditioning = {'samples': raw_seedvr_latent.movedim(-1, 1).contiguous()}  # (B, 16, T, H, W)
Defensive patterns

Strategy: type-guard

Validate before calling

samples = vae_conditioning['samples']
if samples.ndim == 5 and samples.shape[1] != 16 and samples.shape[-1] == 16:
    samples = samples.movedim(-1, 1).contiguous()  # channel-last -> channel-first
vae_conditioning['samples'] = samples

Type guard

def is_channel_first_16c(samples) -> bool:
    return samples.ndim == 5 and samples.shape[1] == 16

Prevention

When it happens

Trigger: Passing a 5-D latent shaped (B, T, H, W, 16) — channel-last — such as a raw SeedVR2 VAE output that was not converted to Comfy's channel-first convention, or a tensor produced by custom code using the original repo's layout.

Common situations: Porting weights/pipelines from the upstream SeedVR2 repo (which uses channel-last video latents); custom nodes that return latents without the movedim(1,-1) normalization Comfy expects.

Related errors


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