Comfy-Org/ComfyUI · error · ValueError
Compositor canvas {cw}x{ch} exceeds the maximum supported si
Error message
Compositor canvas {cw}x{ch} exceeds the maximum supported size of {MAX_RESOLUTION}x{MAX_RESOLUTION} What it means
Before allocating the float32 numpy canvas (ch x cw x 4), composite_from_state checks the resolved canvas dimensions against ComfyUI's MAX_RESOLUTION constant. A canvas larger than that on either axis would imply a multi-gigabyte RGBA buffer, so it is rejected up front with a message naming the offending size and the cap.
Source
Thrown at comfy_extras/nodes_compositor.py:430
def _fill_background(canvas: np.ndarray, background: dict) -> np.ndarray:
layer = np.empty(canvas.shape, dtype=np.float32)
layer[..., :3] = srgb_to_linear(
np.array(hex_to_rgb(background["color"]), dtype=np.float32) / 255.0
)
layer[..., 3] = 1.0
return blend_composite(
resolve_mode("normal"), canvas, layer, background["opacity"]
)
def composite_from_state(
tensors: list[torch.Tensor],
state: dict,
alphas: list[torch.Tensor | None],
) -> torch.Tensor:
cw, ch = state["canvas"]
if cw > MAX_RESOLUTION or ch > MAX_RESOLUTION:
raise ValueError(
f"Compositor canvas {cw}x{ch} exceeds the maximum supported size of "
f"{MAX_RESOLUTION}x{MAX_RESOLUTION}"
)
canvas = np.zeros((ch, cw, 4), dtype=np.float32)
background = state.get("background")
if background is not None and background["visible"] and background["opacity"] > 0:
canvas = _fill_background(canvas, background)
layers = state["layers"]
order = state.get("order") or range(len(tensors))
for index in order:
if index < 0 or index >= len(tensors):
continue
tensor = tensors[index]
entry = layers[index] if index < len(layers) else None
params = _layer_params(entry, tensor.shape[2], tensor.shape[1])
if not params["visible"]:
continue
img = _prepare_layer_bitmap(View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Cap canvas width/height to MAX_RESOLUTION or below in the document (usually 16384).
- Fix the canvas computation upstream — look for a doubled scale factor or concatenated digits.
- Tile the work: composite at a smaller canvas and upscale, or split into regions if true gigapixel output is needed.
Example fix
// before "canvas": [32768, 32768] // after "canvas": [16384, 16384]
Defensive patterns
Strategy: validation
Validate before calling
from nodes import MAX_RESOLUTION
def clamp_canvas(doc):
cw, ch = doc.get("canvas", (0, 0))
if cw > MAX_RESOLUTION or ch > MAX_RESOLUTION:
raise ValueError("canvas too large; fix source data")
return doc Prevention
- Validate canvas dims against MAX_RESOLUTION (16384) before building the document.
- Audit scale-factor math that computes canvas size multiplicatively.
- Split gigapixel composites into tiles.
When it happens
Trigger: A LAYERS document whose canvas field (or derived canvas from the background image) resolves to width or height greater than MAX_RESOLUTION (ComfyUI's standard 16384). For example a canvas of [32768, 512] or layer dimensions propagating a huge size.
Common situations: Typos in canvas JSON (extra digit), documents authored for a different engine with huge canvases, or workflows that compute canvas size by multiplying scale factors and accidentally double the intended resolution.
Related errors
- Bria accepts a width-to-height ratio between {BRIA_MIN_RATIO
- Bria can upscale up to a maximum output dimension of {BRIA_M
- This image cannot be upscaled by Bria at any multiplier: it
- Reference video {index} is too small: {w}x{h} = {pixels:,} t
- Reference video {index} is too large: {w}x{h} = {pixels:,} t
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/9e9a6c2471206c7b.
Report an issue: GitHub.