{"record":{"id":"3eb33cfe5079223b","repo":"Comfy-Org/ComfyUI","slug":"node-name-input-shorter-edge-must-be-at-least-2","errorCode":null,"errorMessage":"{node_name}: input shorter edge must be at least 2 pixels; got {upscaled_shorter_edge}.","messagePattern":"(.+?): input shorter edge must be at least 2 pixels; got (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_seedvr.py","lineNumber":105,"sourceCode":"    videos = torch.cat([videos, padding], dim=1)\n    if (videos.size(1) - 1) % 4 != 0:\n        raise ValueError(f\"SeedVR2Preprocess failed to pad video length to 4n+1; got {videos.size(1)} frames.\")\n    return videos\n\ndef _seedvr2_input_shorter_edge(images, node_name):\n    if images.dim() == 4:\n        return min(images.shape[1], images.shape[2])\n    if images.dim() == 5:\n        return min(images.shape[2], images.shape[3])\n    raise ValueError(\n        f\"{node_name}: expected 4-D or 5-D IMAGE tensor, \"\n        f\"got shape {tuple(images.shape)}\"\n    )\n\n\ndef _seedvr2_pad(images, upscaled_shorter_edge, node_name):\n    if upscaled_shorter_edge < 2:\n        raise ValueError(\n            f\"{node_name}: input shorter edge must be at least 2 pixels; \"\n            f\"got {upscaled_shorter_edge}.\"\n        )\n    if images.shape[-1] > 3:\n        images = images[..., :3]\n    if images.dim() == 4:\n        # Comfy video components arrive as a 4-D IMAGE frame sequence:\n        # (frames, H, W, C). SeedVR2 consumes that as one video.\n        images = images.unsqueeze(0)\n    elif images.dim() != 5:\n        raise ValueError(\n            f\"{node_name}: expected 4-D or 5-D IMAGE tensor, \"\n            f\"got shape {tuple(images.shape)}\"\n        )\n    images = images.permute(0, 1, 4, 2, 3)\n\n    b, t, c, h, w = images.shape\n    images = images.reshape(b * t, c, h, w)","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_seedvr.py#L87-L123","documentation":"_seedvr2_pad refuses inputs whose shorter spatial edge is smaller than 2 pixels. SeedVR2's VAE downsamples spatially by 16x, so a 1-pixel edge cannot produce a valid latent; the check fails fast instead of producing a degenerate tensor downstream.","triggerScenarios":"Feeding an IMAGE whose shorter edge (H or W for 4-D; H or W for 5-D) is 0 or 1 pixel into a SeedVR2 preprocessing/upscale node.","commonSituations":"A resize/crop node set to a 1-pixel dimension; an accidental [:, :1] slice; a placeholder image created with torch.zeros(1,1,1,3) for testing.","solutions":["Set the input image's shorter edge to at least 2 pixels (realistically much larger: remember the VAE pads to multiples of 16).","Fix the upstream resize/crop node that produced the 1-px dimension.","Replace test placeholders smaller than 2 px with a realistic size, e.g. 64x64."],"exampleFix":"# before\nimg = torch.zeros(1, 1, 64, 3)  # 1-px height -> error\n\n# after\nimg = torch.zeros(1, 64, 64, 3)  # valid 64x64 image","handlingStrategy":"validation","validationCode":"h, w = (images.shape[-3], images.shape[-2]) if images.dim() >= 4 else (0, 0)\nassert min(h, w) >= 2, f'image too small: {h}x{w}; SeedVR2 needs shorter edge >= 2'","typeGuard":"def is_seedvr_sized_image(t) -> bool:\n    return t.dim() in (4, 5) and min(t.shape[-3], t.shape[-2]) >= 2","tryCatchPattern":null,"preventionTips":["Use realistic test images (>= 64px per side).","Audit resize/crop node settings for 0/1-pixel dimensions.","Remember the VAE pads to multiples of 16; tiny inputs are almost always a wiring mistake."],"tags":["seedvr","tensor-shape","validation","image"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}