{"record":{"id":"8b3b82b16823de7a","repo":"Comfy-Org/ComfyUI","slug":"seedvr2temporalmerge-chunk-i-has-chunk-shape-2","errorCode":null,"errorMessage":"SeedVR2TemporalMerge: chunk {i} has {chunk.shape[2]} latent frames but chunk 0 has {first.shape[2]}; only the final chunk may be shorter.","messagePattern":"SeedVR2TemporalMerge: chunk (.+?) has (.+?) latent frames but chunk 0 has (.+?); only the final chunk may be shorter\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":558,"sourceCode":"        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\n        if len(chunks) == 1:\n            out[\"samples\"] = first\n            return io.NodeOutput(out)\n        if temporal_overlap == 0:\n            out[\"samples\"] = torch.cat(chunks, dim=2)\n            return io.NodeOutput(out)\n\n        chunk_latent = first.shape[2]\n        step = chunk_latent - min(temporal_overlap, chunk_latent - 1)\n        t_total = step * (len(chunks) - 1) + chunks[-1].shape[2]\n        b, c, _, h, w = first.shape","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L540-L576","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if any(c.shape[2] != chunks[0].shape[2] for c in chunks[1:-1]):\n    # move any short chunk to the end or regenerate it\n    chunks.sort(key=lambda c: c.shape[2] == chunks[0].shape[2], reverse=True)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Chunk scripts should emit equal-length chunks plus at most one tail chunk","Keep chunk order stable when collecting latents from parallel jobs"],"tags":["seedvr","video","latents","temporal"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}