{"record":{"id":"10cd0bdf91a63005","repo":"Comfy-Org/ComfyUI","slug":"seedvr2conditioning-expects-seedvr2-vae-latents-in","errorCode":null,"errorMessage":"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)}.","messagePattern":"SeedVR2Conditioning expects SeedVR2 VAE latents in Comfy channel-first layout \\(B, (.+?), T, H, W\\); got channel-last shape (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":393,"sourceCode":"            ],\n            outputs=[\n                io.Conditioning.Output(display_name=\"positive\", tooltip=\"The positive conditioning for sampling.\"),\n                io.Conditioning.Output(display_name=\"negative\", tooltip=\"The negative conditioning for sampling.\"),\n            ],\n        )\n\n    @classmethod\n    def execute(cls, model, vae_conditioning) -> io.NodeOutput:\n\n        vae_conditioning = vae_conditioning[\"samples\"]\n        if vae_conditioning.ndim != 5:\n            raise ValueError(\n                \"SeedVR2Conditioning expects a 5-D VAE latent in Comfy \"\n                f\"channel-first layout; got shape {tuple(vae_conditioning.shape)}.\"\n            )\n        if vae_conditioning.shape[1] != SEEDVR2_LATENT_CHANNELS:\n            if vae_conditioning.shape[-1] == SEEDVR2_LATENT_CHANNELS:\n                raise ValueError(\n                    \"SeedVR2Conditioning expects SeedVR2 VAE latents in Comfy \"\n                    f\"channel-first layout (B, {SEEDVR2_LATENT_CHANNELS}, T, H, W); \"\n                    f\"got channel-last shape {tuple(vae_conditioning.shape)}.\"\n                )\n            raise ValueError(\n                \"SeedVR2Conditioning expects SeedVR2 VAE latents with \"\n                f\"{SEEDVR2_LATENT_CHANNELS} channels; got shape {tuple(vae_conditioning.shape)}.\"\n            )\n        vae_conditioning = vae_conditioning.movedim(1, -1).contiguous()\n        model = _resolve_seedvr2_diffusion_model(model)\n        pos_cond = model.positive_conditioning\n        neg_cond = model.negative_conditioning\n\n        mask = vae_conditioning.new_ones(vae_conditioning.shape[:-1] + (1,))\n        condition = torch.cat((vae_conditioning, mask), dim=-1)\n        condition = condition.movedim(-1, 1)\n\n        negative = [[neg_cond.unsqueeze(0), {\"condition\": condition}]]","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L375-L411","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Convert the latent to channel-first: latent = latent.movedim(-1, 1).contiguous() before feeding the node.","Prefer using Comfy's own SeedVR2 VAE encode nodes, which already emit channel-first latents.","In custom nodes, normalize to (B, C, T, H, W) at the boundary instead of passing raw upstream layouts through."],"exampleFix":"# before\nvae_conditioning = {'samples': raw_seedvr_latent}  # (B, T, H, W, 16)\n\n# after\nvae_conditioning = {'samples': raw_seedvr_latent.movedim(-1, 1).contiguous()}  # (B, 16, T, H, W)","handlingStrategy":"type-guard","validationCode":"samples = vae_conditioning['samples']\nif samples.ndim == 5 and samples.shape[1] != 16 and samples.shape[-1] == 16:\n    samples = samples.movedim(-1, 1).contiguous()  # channel-last -> channel-first\nvae_conditioning['samples'] = samples","typeGuard":"def is_channel_first_16c(samples) -> bool:\n    return samples.ndim == 5 and samples.shape[1] == 16","tryCatchPattern":null,"preventionTips":["Normalize layout at the integration boundary when porting from upstream SeedVR2 code.","Standardize on (B, C, T, H, W) inside custom nodes.","Write a shape assertion next to every movedim/permute of latents."],"tags":["seedvr","latent","layout","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}