Comfy-Org/ComfyUI · error · ValueError

SeedVR2PostProcessing: color correction requires at least on

Error message

SeedVR2PostProcessing: color correction requires at least one frame.

What it means

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.

Source

Thrown at comfy_extras/nodes_seedvr.py:321

            if color_correction_method == "lab":
                output = cls._lab_color_transfer_on_vae_device(decoded_chunk, reference_chunk, output_device)
            elif color_correction_method == "wavelet":
                output = cls._color_transfer_on_vae_device(
                    decoded_chunk, reference_chunk, output_device, wavelet_color_transfer,
                )
            else:
                output = cls._color_transfer_on_vae_device(
                    decoded_chunk, reference_chunk, output_device, adain_color_transfer,
                )
            if result is None:
                result = torch.empty(
                    (decoded_flat.shape[0],) + tuple(output.shape[1:]),
                    device=output_device,
                    dtype=output.dtype,
                )
            result[start:end].copy_(output)
        if result is None:
            raise ValueError("SeedVR2PostProcessing: color correction requires at least one frame.")
        return result

    @classmethod
    def _estimate_color_correction_chunk_size(cls, decoded_flat, color_correction_method):
        multiplier = cls._color_correction_memory_multiplier(color_correction_method)
        frames = decoded_flat.shape[0]
        _, channels, height, width = decoded_flat.shape
        dtype_bytes = max(decoded_flat.element_size(), SEEDVR2_DTYPE_BYTES_FLOOR)
        bytes_per_frame = height * width * channels * dtype_bytes * multiplier
        if bytes_per_frame <= 0:
            return frames
        color_device = comfy.model_management.vae_device()
        free_memory = comfy.model_management.get_free_memory(color_device)
        chunk_size = int((free_memory * SEEDVR2_COLOR_MEM_HEADROOM) // bytes_per_frame)
        return max(1, min(frames, chunk_size))

    @staticmethod
    def _color_correction_memory_multiplier(color_correction_method):

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Guarantee at least one frame in the decoded batch before running postprocessing (shape[0] >= 1).
  2. Fix the upstream node producing the empty frame set.
  3. Use color_correction_method='none' as a bypass only if frames genuinely should be empty — better to error early at the source.
Defensive patterns

Strategy: validation

Validate before calling

if decoded_flat.shape[0] < 1:
    raise ValueError('color correction requires >= 1 frame; got 0')

Type guard

def has_frames_flat(t) -> bool:
    return t.shape[0] >= 1

Prevention

When it happens

Trigger: 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'.

Common situations: Upstream empty batch (empty frame range, filtered-out frames); placeholder tensors sized (0, 3, H, W) in tests; batch-slicing code that selects nothing.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/459546a6a52c7344. Report an issue: GitHub.