Comfy-Org/ComfyUI · error · ValueError
Unsupported blend mode: {mode}
Error message
Unsupported blend mode: {mode} What it means
Raised by the static blend helper in the post-processing nodes when the mode string matches none of normal/multiply/screen/overlay/soft_light/difference. The combo UI constrains choices; the raise is the terminal fallback after the if/elif chain, reachable only with non-standard input.
Source
Thrown at comfy_extras/nodes_post_processing.py:66
blended_image = image1 * (1 - blend_factor) + blended_image * blend_factor
blended_image = torch.clamp(blended_image, 0, 1)
return io.NodeOutput(blended_image)
@classmethod
def blend_mode(cls, img1, img2, mode):
if mode == "normal":
return img2
elif mode == "multiply":
return img1 * img2
elif mode == "screen":
return 1 - (1 - img1) * (1 - img2)
elif mode == "overlay":
return torch.where(img1 <= 0.5, 2 * img1 * img2, 1 - 2 * (1 - img1) * (1 - img2))
elif mode == "soft_light":
return torch.where(img2 <= 0.5, img1 - (1 - 2 * img2) * img1 * (1 - img1), img1 + (2 * img2 - 1) * (cls.g(img1) - img1))
elif mode == "difference":
return img1 - img2
raise ValueError(f"Unsupported blend mode: {mode}")
@classmethod
def g(cls, x):
return torch.where(x <= 0.25, ((16 * x - 12) * x + 4) * x, torch.sqrt(x))
def gaussian_kernel(kernel_size: int, sigma: float, device=None, dtype=torch.float32):
x, y = torch.meshgrid(torch.linspace(-1, 1, kernel_size, device=device), torch.linspace(-1, 1, kernel_size, device=device), indexing="ij")
d = torch.sqrt(x * x + y * y)
g = torch.exp(-(d * d) / (2.0 * sigma * sigma))
return (g / g.sum()).to(dtype)
class Blur(io.ComfyNode):
@classmethod
def define_schema(cls):
return io.Schema(
node_id="ImageBlur",
display_name="Blur Image",
category="image/filters",View on GitHub (pinned to 1c6d8d45b3)
Solutions
- Use one of the exact strings: 'normal', 'multiply', 'screen', 'overlay', 'soft_light', 'difference'.
- Map unsupported modes to the closest implemented one before submitting (e.g. hard_light -> overlay).
- Validate the mode against combo options from /object_info in API scripts.
Example fix
// before
{"mode": "hard_light"}
// after
{"mode": "overlay"} Defensive patterns
Strategy: validation
Validate before calling
VALID_BLEND_MODES = {'normal', 'multiply', 'screen', 'overlay', 'soft_light', 'difference'}
if mode not in VALID_BLEND_MODES:
raise ValueError(f"mode must be one of {sorted(VALID_BLEND_MODES)}") Type guard
def is_supported_blend_mode(mode: str) -> bool:
return mode in {'normal', 'multiply', 'screen', 'overlay', 'soft_light', 'difference'} Prevention
- Don't assume the full Photoshop/SVG blend-mode list is available — check the node's combo.
- Map unsupported modes (hard_light, darken) to the nearest implemented mode upstream.
When it happens
Trigger: Calling Blend (or any node reusing this helper) via API or hand-edited workflow with a mode like 'hard_light', 'darken', or a typo such as 'multiply '. Only unmatched strings reach the raise.
Common situations: Porting blend-mode lists from Photoshop/SVG that include modes this node never implemented (hard_light, darken, lighten, color-dodge); trailing-whitespace or case typos in generated prompts.
Related errors
- Invalid operation {operation} for morphology. Must be one of
- INVALID_QUERY
- Unknown SeedVR2 VAE forward mode: {mode}
- Unsupported splat format: {format!r}
- Unknown latent_format: {latent_format}
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/27d2a17e43f57ad2.
Report an issue: GitHub.