{"record":{"id":"f14bbce55f89e0f1","repo":"Comfy-Org/ComfyUI","slug":"image-height-must-be-at-least-min-height-px-got","errorCode":null,"errorMessage":"Image height must be at least {min_height}px, got {height}px","messagePattern":"Image height must be at least (.+?)px, got (.+?)px","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/util/validation_utils.py","lineNumber":31,"sourceCode":"    else:\n        raise ValueError(\"Invalid image tensor shape.\")\n\n\ndef validate_image_dimensions(\n    image: torch.Tensor,\n    min_width: int | None = None,\n    max_width: int | None = None,\n    min_height: int | None = None,\n    max_height: int | None = None,\n):\n    height, width = get_image_dimensions(image)\n\n    if min_width is not None and width < min_width:\n        raise ValueError(f\"Image width must be at least {min_width}px, got {width}px\")\n    if max_width is not None and width > max_width:\n        raise ValueError(f\"Image width must be at most {max_width}px, got {width}px\")\n    if min_height is not None and height < min_height:\n        raise ValueError(f\"Image height must be at least {min_height}px, got {height}px\")\n    if max_height is not None and height > max_height:\n        raise ValueError(f\"Image height must be at most {max_height}px, got {height}px\")\n\n\ndef validate_image_aspect_ratio(\n    image: torch.Tensor,\n    min_ratio: tuple[float, float] | None = None,  # e.g. (1, 4)\n    max_ratio: tuple[float, float] | None = None,  # e.g. (4, 1)\n    *,\n    strict: bool = True,  # True -> (min, max); False -> [min, max]\n) -> float:\n    \"\"\"Validates that image aspect ratio is within min and max. If a bound is None, that side is not checked.\"\"\"\n    w, h = get_image_dimensions(image)\n    if w <= 0 or h <= 0:\n        raise ValueError(f\"Invalid image dimensions: {w}x{h}\")\n    ar = w / h\n    _assert_ratio_bounds(ar, min_ratio=min_ratio, max_ratio=max_ratio, strict=strict)\n    return ar","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/util/validation_utils.py#L13-L49","documentation":"ValueError from validate_image_dimensions when image height is below the required minimum. Height is shape[1] for [B,H,W,C] and shape[0] for [H,W,C]. Enforced before the API call so undersized images fail fast with a clear message.","triggerScenarios":"validate_image_dimensions(image, min_height=N) with height < N — e.g., a 512x512 image into a node requiring min_height=768.","commonSituations":"Small source images or aggressive downscaling in the workflow; square images failing tall-format requirements of a provider.","solutions":["Upscale or re-generate to reach height >= min_height.","Fix upstream resize nodes producing too-small outputs.","Pick a provider/node with lower minimum height requirements."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"def check_min_height(image: torch.Tensor, min_height: int) -> bool:\n    h = image.shape[1] if image.dim() == 4 else image.shape[0]\n    return h >= min_height","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check provider minimums for both axes, not just width","Upscale small sources before API image nodes"],"tags":["validation","image","dimensions"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}