{"record":{"id":"507f96e5af6f48ef","repo":"Comfy-Org/ComfyUI","slug":"seedvr2postprocessing-lab-color-correction-requir","errorCode":null,"errorMessage":"SeedVR2PostProcessing: LAB color correction requires at least one frame.","messagePattern":"SeedVR2PostProcessing: LAB color correction requires at least one frame\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":276,"sourceCode":"        return output.to(device=output_device)\n\n    @staticmethod\n    def _lab_color_transfer_on_vae_device(decoded_flat, reference_flat, output_device):\n        color_device = comfy.model_management.vae_device()\n        result = None\n        for start in range(decoded_flat.shape[0]):\n            decoded_frame = decoded_flat[start:start + 1].to(device=color_device).clone()\n            reference_frame = reference_flat[start:start + 1].to(device=color_device).clone()\n            output = lab_color_transfer(decoded_frame, reference_frame).to(device=output_device)\n            if result is None:\n                result = torch.empty(\n                    (decoded_flat.shape[0],) + tuple(output.shape[1:]),\n                    device=output_device,\n                    dtype=output.dtype,\n                )\n            result[start:start + 1].copy_(output)\n        if result is None:\n            raise ValueError(\"SeedVR2PostProcessing: LAB color correction requires at least one frame.\")\n        return result\n\n    @classmethod\n    def _color_transfer_chunked(cls, decoded_flat, reference_flat, output_device, color_correction_method):\n        chunk_size = cls._estimate_color_correction_chunk_size(decoded_flat, color_correction_method)\n        while True:\n            try:\n                return cls._run_color_transfer_chunks(\n                    decoded_flat, reference_flat, output_device, color_correction_method, chunk_size,\n                )\n            except Exception as e:\n                comfy.model_management.raise_non_oom(e)\n                if chunk_size <= 1:\n                    raise RuntimeError(\n                        \"SeedVR2PostProcessing: color correction OOM at one frame; \"\n                        f\"color_correction_method={color_correction_method}, shape={tuple(decoded_flat.shape)}.\"\n                    ) from e\n                chunk_size = max(1, chunk_size // SEEDVR2_OOM_BACKOFF_DIVISOR)","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L258-L294","documentation":"The LAB color-transfer loop iterates over decoded_flat.shape[0]; if that is 0 (no frames at all) the loop never runs, result stays None, and this error is raised. It is effectively an empty-input guard for the per-frame lab_color_transfer path.","triggerScenarios":"A decoded tensor with a zero-length frame/batch dimension reaching the LAB color correction branch — e.g. an empty image list converted to a 0-frame tensor upstream.","commonSituations":"Empty batch from a filtered/empty image set; an upstream node emitting 0 frames (empty video range); a placeholder tensor created with torch.empty(0,3,H,W).","solutions":["Ensure the decoded image batch has at least one frame before calling the node (tensor.shape[0] >= 1).","Fix the upstream frame selection that produced an empty batch.","Skip color correction entirely for empty inputs instead of invoking the node."],"exampleFix":"# before\nframes = [f for f in frames if f.mean() > 0]  # may become []\nout = postprocess(torch.stack(frames))\n\n# after\nif not frames:\n    raise ValueError('no frames to process')\nout = postprocess(torch.stack(frames))","handlingStrategy":"validation","validationCode":"if decoded_flat.shape[0] < 1:\n    raise ValueError('cannot run LAB color correction on 0 frames')","typeGuard":"def has_at_least_one_frame(t) -> bool:\n    return t.dim() >= 1 and t.shape[0] >= 1","tryCatchPattern":null,"preventionTips":["Guard empty batches before postprocessing nodes.","Make frame filters never return zero items (fallback to last frame if needed).","Treat 0-length tensors as upstream errors, not postprocessing inputs."],"tags":["seedvr","color-correction","empty-input","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}