Comfy-Org/ComfyUI · error · ValueError
Output size ({output_width}x{output_height} = {output_pixels
Error message
Output size ({output_width}x{output_height} = {output_pixels:,} pixels) exceeds maximum allowed size of {MAX_PIXELS_GENERATIVE:,} pixels ({MAX_MP_GENERATIVE}MP). Enable auto_downscale or use a smaller input image or a lower upscale factor. What it means
Thrown by Hitpaw photo enhancement when width*height*scale^2 exceeds MAX_PIXELS_GENERATIVE and auto_downscale is disabled. With auto_downscale=True the node instead walks candidate scales [4,2,1] and optionally downscales the input by up to 2x to fit; the error is the explicit refusal path when the user wants no automatic shrinking. The message states the computed output size and the exact pixel cap.
Source
Thrown at comfy_api_nodes/nodes_hitpaw.py:153
scale_output_pixels = input_pixels * candidate * candidate
if scale_output_pixels <= MAX_PIXELS_GENERATIVE:
scale = candidate
max_input_pixels = None
break
# Check if we can downscale input by at most 2x to fit
downscale_ratio = math.sqrt(scale_output_pixels / MAX_PIXELS_GENERATIVE)
if downscale_ratio <= 2.0:
scale = candidate
max_input_pixels = MAX_PIXELS_GENERATIVE // (candidate * candidate)
break
if max_input_pixels is not None:
image = downscale_image_tensor(image, total_pixels=max_input_pixels)
upscale_factor = scale
else:
output_width = width * requested_scale
output_height = height * requested_scale
raise ValueError(
f"Output size ({output_width}x{output_height} = {output_pixels:,} pixels) "
f"exceeds maximum allowed size of {MAX_PIXELS_GENERATIVE:,} pixels ({MAX_MP_GENERATIVE}MP). "
f"Enable auto_downscale or use a smaller input image or a lower upscale factor."
)
initial_res = await sync_op(
cls,
ApiEndpoint(path="/proxy/hitpaw/api/photo-enhancer", method="POST"),
response_model=TaskCreateResponse,
data=ImageEnhanceTaskCreateRequest(
model_name=f"{model}_{upscale_factor}x",
img_url=await upload_image_to_comfyapi(cls, image, total_pixels=None),
),
wait_label="Creating task",
final_label_on_success="Task created",
)
if initial_res.code != 200:
raise ValueError(f"Task creation failed with code {initial_res.code}: {initial_res.message}")View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Enable auto_downscale — the node picks the largest fitting scale (and at most a 2x input downscale) automatically
- Lower upscale_factor to 1 or 2 so output stays under the cap
- Pre-downscale the input image so input_pixels * scale^2 fits within MAX_PIXELS_GENERATIVE
Example fix
# before auto_downscale = False; upscale_factor = 4 # 8000x8000 input -> error # after auto_downscale = True # node auto-selects a fitting scale, e.g. 2x or 1x
Defensive patterns
Strategy: validation
Validate before calling
from comfy_api_nodes.utils import get_image_dimensions
from comfy_api_nodes.nodes_hitpaw import MAX_PIXELS_GENERATIVE
def enhance_output_fits(image, scale: int) -> bool:
h, w = get_image_dimensions(image)
return h * w * scale * scale <= MAX_PIXELS_GENERATIVE Prevention
- Leave auto_downscale enabled for unattended pipelines
- Check input megapixels before selecting 4x — the cap is on output pixels
When it happens
Trigger: Large input combined with upscale_factor 2/4 such that output pixels exceed the cap; e.g. a 6000x6000 image with 4x selected. Only raised when auto_downscale=False.
Common situations: Users upscaling already-high-resolution outputs from generation pipelines, or chaining enhancers where a previous 4x pass feeds this one.
Related errors
- Selected resolution {resolution} ({target_size}x{target_size
- Output size ({width * requested_scale}x{height * requested_s
- Unsupported process_res_method: {method}
- At least 4 points are required to compute a homography.
- Unknown reference view selection strategy: {strategy!r}. Mus
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/400d7f10106abe14.
Report an issue: GitHub.