Comfy-Org/ComfyUI · error · ValueError

Unknown model: {model}

Error message

Unknown model: {model}

What it means

Client-side ValueError from the OpenAI image node's model whitelist: the model string is neither gpt-image-2 nor gpt-image-1/1.5, so it falls through to Unknown model. This guards against typos and unsupported model names before any network call.

Source

Thrown at comfy_api_nodes/nodes_openai.py:564

            if ratio > 3:
                raise ValueError(
                    f"Custom resolution aspect ratio must not exceed 3:1, got {custom_width}x{custom_height}"
                )
            total_pixels = custom_width * custom_height
            if not 655_360 <= total_pixels <= 8_294_400:
                raise ValueError(
                    f"Custom resolution total pixels must be between 655,360 and 8,294,400, got {total_pixels}"
                )
            size = f"{custom_width}x{custom_height}"
        elif model in ("gpt-image-1", "gpt-image-1.5"):
            if size not in ("auto", "1024x1024", "1024x1536", "1536x1024"):
                raise ValueError(f"Resolution {size} is only supported by GPT Image 2 model")

        if model == "gpt-image-2":
            if background == "transparent":
                raise ValueError("Transparent background is not supported for GPT Image 2 model")
        elif model not in ("gpt-image-1", "gpt-image-1.5"):
            raise ValueError(f"Unknown model: {model}")

        if image is not None:
            files = []
            batch_size = image.shape[0]
            for i in range(batch_size):
                single_image = image[i : i + 1]
                scaled_image = downscale_image_tensor(single_image, total_pixels=2048 * 2048).squeeze()

                image_np = (scaled_image.numpy() * 255).astype(np.uint8)
                img = Image.fromarray(image_np)
                img_byte_arr = BytesIO()
                img.save(img_byte_arr, format="PNG")
                img_byte_arr.seek(0)

                if batch_size == 1:
                    files.append(("image", (f"image_{i}.png", img_byte_arr, "image/png")))
                else:
                    files.append(("image[]", (f"image_{i}.png", img_byte_arr, "image/png")))

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Use one of the supported values: gpt-image-1, gpt-image-1.5, or gpt-image-2
  2. Reset the model widget so it re-populates from the node's current combo options
  3. For Dall-E 2/3, use the dedicated OpenAIImageEdit/legacy nodes instead of this one

Example fix

// before
model="dall-e-3"
// after
model="gpt-image-1"  # or "gpt-image-1.5" / "gpt-image-2"
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED = {"gpt-image-1", "gpt-image-1.5", "gpt-image-2"}
assert model in SUPPORTED, f"model must be one of {sorted(SUPPORTED)}"

Type guard

def is_supported_model(model: str) -> bool:
    return model in {"gpt-image-1", "gpt-image-1.5", "gpt-image-2"}

Prevention

When it happens

Trigger: Passing model strings like 'dall-e-3', 'gpt-image', 'gpt-4o', or a misspelling such as 'gpt-image1' to this node.

Common situations: Hand-edited workflow JSON with a wrong model value; combo widget holding a stale value after a rename; attempting to use Dall-E models through the gpt-image node instead of the dedicated nodes.

Related errors


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