Comfy-Org/ComfyUI · error · ValueError
SeedVR2PostProcessing: LAB color correction requires at leas
Error message
SeedVR2PostProcessing: LAB color correction requires at least one frame.
What it means
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.
Source
Thrown at comfy_extras/nodes_seedvr.py:276
return output.to(device=output_device)
@staticmethod
def _lab_color_transfer_on_vae_device(decoded_flat, reference_flat, output_device):
color_device = comfy.model_management.vae_device()
result = None
for start in range(decoded_flat.shape[0]):
decoded_frame = decoded_flat[start:start + 1].to(device=color_device).clone()
reference_frame = reference_flat[start:start + 1].to(device=color_device).clone()
output = lab_color_transfer(decoded_frame, reference_frame).to(device=output_device)
if result is None:
result = torch.empty(
(decoded_flat.shape[0],) + tuple(output.shape[1:]),
device=output_device,
dtype=output.dtype,
)
result[start:start + 1].copy_(output)
if result is None:
raise ValueError("SeedVR2PostProcessing: LAB color correction requires at least one frame.")
return result
@classmethod
def _color_transfer_chunked(cls, decoded_flat, reference_flat, output_device, color_correction_method):
chunk_size = cls._estimate_color_correction_chunk_size(decoded_flat, color_correction_method)
while True:
try:
return cls._run_color_transfer_chunks(
decoded_flat, reference_flat, output_device, color_correction_method, chunk_size,
)
except Exception as e:
comfy.model_management.raise_non_oom(e)
if chunk_size <= 1:
raise RuntimeError(
"SeedVR2PostProcessing: color correction OOM at one frame; "
f"color_correction_method={color_correction_method}, shape={tuple(decoded_flat.shape)}."
) from e
chunk_size = max(1, chunk_size // SEEDVR2_OOM_BACKOFF_DIVISOR)View on GitHub (pinned to 1c6d8d45b3)
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.
Example fix
# before
frames = [f for f in frames if f.mean() > 0] # may become []
out = postprocess(torch.stack(frames))
# after
if not frames:
raise ValueError('no frames to process')
out = postprocess(torch.stack(frames)) Defensive patterns
Strategy: validation
Validate before calling
if decoded_flat.shape[0] < 1:
raise ValueError('cannot run LAB color correction on 0 frames') Type guard
def has_at_least_one_frame(t) -> bool:
return t.dim() >= 1 and t.shape[0] >= 1 Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- SeedVR2PostProcessing: color correction requires at least on
- No images provided to create_image_parts; at least one image
- Cannot create grid from empty image list
- SplatToFile3D: gaussian is empty
- Expression cannot be empty.
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/507f96e5af6f48ef.
Report an issue: GitHub.