{"record":{"id":"921ccfefbcc1b9c1","repo":"Comfy-Org/ComfyUI","slug":"seedvr2temporalmerge-expected-5-d-video-latents","errorCode":null,"errorMessage":"SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H, W); chunk 0 has shape {tuple(first.shape)}.","messagePattern":"SeedVR2TemporalMerge: expected 5-D video latents \\(B, C, T, H, W\\); chunk 0 has shape (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":547,"sourceCode":"                io.Int.Input(\"temporal_overlap\", default=0, min=0, max=16384, force_input=True,\n                             tooltip=\"The temporal_overlap output of Split SeedVR2 Latent. 0 = plain concatenation.\"),\n            ],\n            outputs=[\n                io.Latent.Output(display_name=\"latent\", tooltip=\"The recombined full-length latent.\"),\n            ],\n        )\n\n    @classmethod\n    def execute(cls, latents, temporal_overlap) -> io.NodeOutput:\n        temporal_overlap = temporal_overlap[0]\n        if temporal_overlap < 0:\n            raise ValueError(\n                f\"SeedVR2TemporalMerge: temporal_overlap must be >= 0; got {temporal_overlap}.\"\n            )\n        chunks = [entry[\"samples\"] for entry in latents]\n        first = chunks[0]\n        if first.ndim != 5:\n            raise ValueError(\n                f\"SeedVR2TemporalMerge: expected 5-D video latents (B, C, T, H, W); \"\n                f\"chunk 0 has shape {tuple(first.shape)}.\"\n            )\n        for i, chunk in enumerate(chunks[1:], start=1):\n            if chunk.shape[:2] != first.shape[:2] or chunk.shape[3:] != first.shape[3:]:\n                raise ValueError(\n                    f\"SeedVR2TemporalMerge: chunk {i} shape {tuple(chunk.shape)} does not \"\n                    f\"match chunk 0 shape {tuple(first.shape)} outside the temporal axis.\"\n                )\n            if i < len(chunks) - 1 and chunk.shape[2] != first.shape[2]:\n                raise ValueError(\n                    f\"SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent frames but \"\n                    f\"chunk 0 has {first.shape[2]}; only the final chunk may be shorter.\"\n                )\n\n        out = latents[0].copy()\n        out.pop(\"noise_mask\", None)\n","sourceCodeStart":529,"sourceCodeEnd":565,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L529-L565","documentation":"SeedVR2TemporalMerge merges temporally-chunked video latents and requires each chunk to be a 5-D tensor shaped (B, C, T, H, W). The first chunk is checked with ndim != 5, so any 4-D image latent or differently-ranked tensor is rejected before concatenation. This guard exists because torch.cat along dim=2 and the overlap-blending logic only make sense for video latents produced by a video VAE.","triggerScenarios":"Feeding the node a list of latents where entry['samples'] is 4-D (B, C, H, W) — e.g. outputs of an image VAE encode, a VAEDecode-to-latent round trip on single images, or a latent from LoadImage-based image workflows instead of the SeedVR2 video restoration path.","commonSituations":"Using SeedVR2 image restoration nodes (which emit 4-D latents) with the temporal merge node meant for SeedVR2 video chunked restoration; hand-building the latents list from image latents; converting a video workflow to images and forgetting the merge node is video-only.","solutions":["Feed only video latents (5-D) from the SeedVR2 video VAE encode path into SeedVR2TemporalMerge","If you have single-frame latents, unsqueeze/stack them to (B, C, T, H, W) with T frames before merging","For image (non-video) restoration, bypass SeedVR2TemporalMerge entirely — it is only for chunked video processing"],"exampleFix":"# before: image latents (B, C, H, W) passed to temporal merge\nmerge = SeedVR2TemporalMerge.execute(latents, overlap)\n\n# after: ensure 5-D video latents from the video VAE\n# latents[i][\"samples\"].shape == (B, C, T, H, W)","handlingStrategy":"type-guard","validationCode":"chunks = [e[\"samples\"] for e in latents]\nif any(c.ndim != 5 for c in chunks):\n    raise SystemExit(\"Need 5-D (B, C, T, H, W) video latents; got \" + str([tuple(c.shape) for c in chunks]))","typeGuard":"def is_video_latent(t) -> bool:\n    return isinstance(t, torch.Tensor) and t.ndim == 5","tryCatchPattern":null,"preventionTips":["Always source temporal-merge latents from the video VAE encode path, never image latents","Log chunk shapes before merging when building custom chunk pipelines"],"tags":["seedvr","video","latents","shape-validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}