{"record":{"id":"27d2a17e43f57ad2","repo":"Comfy-Org/ComfyUI","slug":"unsupported-blend-mode-mode","errorCode":null,"errorMessage":"Unsupported blend mode: {mode}","messagePattern":"Unsupported blend mode: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_extras/nodes_post_processing.py","lineNumber":66,"sourceCode":"        blended_image = image1 * (1 - blend_factor) + blended_image * blend_factor\n        blended_image = torch.clamp(blended_image, 0, 1)\n        return io.NodeOutput(blended_image)\n\n    @classmethod\n    def blend_mode(cls, img1, img2, mode):\n        if mode == \"normal\":\n            return img2\n        elif mode == \"multiply\":\n            return img1 * img2\n        elif mode == \"screen\":\n            return 1 - (1 - img1) * (1 - img2)\n        elif mode == \"overlay\":\n            return torch.where(img1 <= 0.5, 2 * img1 * img2, 1 - 2 * (1 - img1) * (1 - img2))\n        elif mode == \"soft_light\":\n            return torch.where(img2 <= 0.5, img1 - (1 - 2 * img2) * img1 * (1 - img1), img1 + (2 * img2 - 1) * (cls.g(img1) - img1))\n        elif mode == \"difference\":\n            return img1 - img2\n        raise ValueError(f\"Unsupported blend mode: {mode}\")\n\n    @classmethod\n    def g(cls, x):\n        return torch.where(x <= 0.25, ((16 * x - 12) * x + 4) * x, torch.sqrt(x))\n\ndef gaussian_kernel(kernel_size: int, sigma: float, device=None, dtype=torch.float32):\n    x, y = torch.meshgrid(torch.linspace(-1, 1, kernel_size, device=device), torch.linspace(-1, 1, kernel_size, device=device), indexing=\"ij\")\n    d = torch.sqrt(x * x + y * y)\n    g = torch.exp(-(d * d) / (2.0 * sigma * sigma))\n    return (g / g.sum()).to(dtype)\n\nclass Blur(io.ComfyNode):\n    @classmethod\n    def define_schema(cls):\n        return io.Schema(\n            node_id=\"ImageBlur\",\n            display_name=\"Blur Image\",\n            category=\"image/filters\",","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_extras/nodes_post_processing.py#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n{\"mode\": \"hard_light\"}\n// after\n{\"mode\": \"overlay\"}","handlingStrategy":"validation","validationCode":"VALID_BLEND_MODES = {'normal', 'multiply', 'screen', 'overlay', 'soft_light', 'difference'}\nif mode not in VALID_BLEND_MODES:\n    raise ValueError(f\"mode must be one of {sorted(VALID_BLEND_MODES)}\")","typeGuard":"def is_supported_blend_mode(mode: str) -> bool:\n    return mode in {'normal', 'multiply', 'screen', 'overlay', 'soft_light', 'difference'}","tryCatchPattern":null,"preventionTips":["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."],"tags":["blend","image-processing","invalid-argument","post-processing"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}