{"record":{"id":"7520e3ab83788674","repo":"Comfy-Org/ComfyUI","slug":"resolution-size-is-only-supported-by-gpt-image-2","errorCode":null,"errorMessage":"Resolution {size} is only supported by GPT Image 2 model","messagePattern":"Resolution (.+?) is only supported by GPT Image 2 model","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_openai.py","lineNumber":558,"sourceCode":"                raise ValueError(\"Custom resolution is only supported by GPT Image 2 model\")\n            if custom_width % 16 != 0 or custom_height % 16 != 0:\n                raise ValueError(f\"Custom width and height must be multiples of 16, got {custom_width}x{custom_height}\")\n            if max(custom_width, custom_height) > 3840:\n                raise ValueError(f\"Custom resolution max edge must be <= 3840, got {custom_width}x{custom_height}\")\n            ratio = max(custom_width, custom_height) / min(custom_width, custom_height)\n            if ratio > 3:\n                raise ValueError(\n                    f\"Custom resolution aspect ratio must not exceed 3:1, got {custom_width}x{custom_height}\"\n                )\n            total_pixels = custom_width * custom_height\n            if not 655_360 <= total_pixels <= 8_294_400:\n                raise ValueError(\n                    f\"Custom resolution total pixels must be between 655,360 and 8,294,400, got {total_pixels}\"\n                )\n            size = f\"{custom_width}x{custom_height}\"\n        elif model in (\"gpt-image-1\", \"gpt-image-1.5\"):\n            if size not in (\"auto\", \"1024x1024\", \"1024x1536\", \"1536x1024\"):\n                raise ValueError(f\"Resolution {size} is only supported by GPT Image 2 model\")\n\n        if model == \"gpt-image-2\":\n            if background == \"transparent\":\n                raise ValueError(\"Transparent background is not supported for GPT Image 2 model\")\n        elif model not in (\"gpt-image-1\", \"gpt-image-1.5\"):\n            raise ValueError(f\"Unknown model: {model}\")\n\n        if image is not None:\n            files = []\n            batch_size = image.shape[0]\n            for i in range(batch_size):\n                single_image = image[i : i + 1]\n                scaled_image = downscale_image_tensor(single_image, total_pixels=2048 * 2048).squeeze()\n\n                image_np = (scaled_image.numpy() * 255).astype(np.uint8)\n                img = Image.fromarray(image_np)\n                img_byte_arr = BytesIO()\n                img.save(img_byte_arr, format=\"PNG\")","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_openai.py#L540-L576","documentation":"Client-side ValueError raised when the model is gpt-image-1 or gpt-image-1.5 and size is not one of the four supported presets ('auto','1024x1024','1024x1536','1536x1024'). Older GPT Image models only accept fixed resolutions; arbitrary sizes are a GPT Image 2 capability, so the node blocks the combination before the request.","triggerScenarios":"model='gpt-image-1' with size='1536x1536', '512x512', 'Custom', or any string outside the allowlist.","commonSituations":"Saved workflows from other providers (e.g. Dall-E sizes like 512x512) reused with gpt-image-1; hand-edited workflow JSON with a size string; switching models without updating the size widget.","solutions":["Set size to one of auto/1024x1024/1024x1536/1536x1024 for gpt-image-1/1.5","Or switch the model to gpt-image-2 and pass Custom dimensions that satisfy its constraints","Fix stale workflow JSON so the size widget value matches the selected model"],"exampleFix":"// before\nmodel=\"gpt-image-1\", size=\"512x512\"\n// after\nmodel=\"gpt-image-1\", size=\"1024x1024\"\n// or use gpt-image-2 with valid Custom dimensions","handlingStrategy":"validation","validationCode":"GPT_IMAGE1_SIZES = {\"auto\", \"1024x1024\", \"1024x1536\", \"1536x1024\"}\nif model in (\"gpt-image-1\", \"gpt-image-1.5\"):\n    assert size in GPT_IMAGE1_SIZES, f\"{size} not valid for {model}\"","typeGuard":"def size_valid_for_model(model: str, size: str) -> bool:\n    if model in (\"gpt-image-1\", \"gpt-image-1.5\"):\n        return size in {\"auto\", \"1024x1024\", \"1024x1536\", \"1536x1024\"}\n    return True","tryCatchPattern":null,"preventionTips":["Update the size widget whenever the model widget changes","Do not reuse Dall-E-era size strings with gpt-image models","Validate saved workflow JSON after model renames"],"tags":["openai","gpt-image","resolution","validation"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}