{"record":{"id":"459546a6a52c7344","repo":"Comfy-Org/ComfyUI","slug":"seedvr2postprocessing-color-correction-requires-a","errorCode":null,"errorMessage":"SeedVR2PostProcessing: color correction requires at least one frame.","messagePattern":"SeedVR2PostProcessing: color correction requires at least one frame\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":321,"sourceCode":"            if color_correction_method == \"lab\":\n                output = cls._lab_color_transfer_on_vae_device(decoded_chunk, reference_chunk, output_device)\n            elif color_correction_method == \"wavelet\":\n                output = cls._color_transfer_on_vae_device(\n                    decoded_chunk, reference_chunk, output_device, wavelet_color_transfer,\n                )\n            else:\n                output = cls._color_transfer_on_vae_device(\n                    decoded_chunk, reference_chunk, output_device, adain_color_transfer,\n                )\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:end].copy_(output)\n        if result is None:\n            raise ValueError(\"SeedVR2PostProcessing: color correction requires at least one frame.\")\n        return result\n\n    @classmethod\n    def _estimate_color_correction_chunk_size(cls, decoded_flat, color_correction_method):\n        multiplier = cls._color_correction_memory_multiplier(color_correction_method)\n        frames = decoded_flat.shape[0]\n        _, channels, height, width = decoded_flat.shape\n        dtype_bytes = max(decoded_flat.element_size(), SEEDVR2_DTYPE_BYTES_FLOOR)\n        bytes_per_frame = height * width * channels * dtype_bytes * multiplier\n        if bytes_per_frame <= 0:\n            return frames\n        color_device = comfy.model_management.vae_device()\n        free_memory = comfy.model_management.get_free_memory(color_device)\n        chunk_size = int((free_memory * SEEDVR2_COLOR_MEM_HEADROOM) // bytes_per_frame)\n        return max(1, min(frames, chunk_size))\n\n    @staticmethod\n    def _color_correction_memory_multiplier(color_correction_method):","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L303-L339","documentation":"The chunked color-transfer runner allocates the result tensor lazily on the first processed chunk. If the frame dimension of decoded_flat is 0, the loop over range(0, 0, chunk_size) never executes, result stays None, and this guard raises. It is an empty-input check for the adain/wavelet chunked path.","triggerScenarios":"decoded_flat.shape[0] == 0 — an empty (0, C, H, W) tensor reaching _run_color_transfer_chunks, e.g. from a 0-frame decoded video with color_correction_method='adain' or 'wavelet'.","commonSituations":"Upstream empty batch (empty frame range, filtered-out frames); placeholder tensors sized (0, 3, H, W) in tests; batch-slicing code that selects nothing.","solutions":["Guarantee at least one frame in the decoded batch before running postprocessing (shape[0] >= 1).","Fix the upstream node producing the empty frame set.","Use color_correction_method='none' as a bypass only if frames genuinely should be empty — better to error early at the source."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if decoded_flat.shape[0] < 1:\n    raise ValueError('color correction requires >= 1 frame; got 0')","typeGuard":"def has_frames_flat(t) -> bool:\n    return t.shape[0] >= 1","tryCatchPattern":null,"preventionTips":["Reject empty frame batches at the loader/slicer level.","Never build (0,C,H,W) placeholder tensors.","Log batch size right before postprocessing in custom pipelines."],"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"}