lllyasviel/Fooocus · error · ValueError

Unsupported blend mode: {mode}

Error message

Unsupported blend mode: {mode}

What it means

LatentBlend.blend_mode() in this vendored ComfyUI node currently implements only the 'normal' mode (returning img2) and raises ValueError for anything else — despite blend_factor and blend_mode inputs suggesting richer support. So any non-'normal' string is fatal at execution time, after both latents are already prepared (including an expensive common_upscale).

Source

Thrown at ldm_patched/contrib/external.py:1262

        samples_out = samples1.copy()
        samples1 = samples1["samples"]
        samples2 = samples2["samples"]

        if samples1.shape != samples2.shape:
            samples2.permute(0, 3, 1, 2)
            samples2 = ldm_patched.modules.utils.common_upscale(samples2, samples1.shape[3], samples1.shape[2], 'bicubic', crop='center')
            samples2.permute(0, 2, 3, 1)

        samples_blended = self.blend_mode(samples1, samples2, blend_mode)
        samples_blended = samples1 * blend_factor + samples_blended * (1 - blend_factor)
        samples_out["samples"] = samples_blended
        return (samples_out,)

    def blend_mode(self, img1, img2, mode):
        if mode == "normal":
            return img2
        else:
            raise ValueError(f"Unsupported blend mode: {mode}")

class LatentCrop:
    @classmethod
    def INPUT_TYPES(s):
        return {"required": { "samples": ("LATENT",),
                              "width": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}),
                              "height": ("INT", {"default": 512, "min": 64, "max": MAX_RESOLUTION, "step": 8}),
                              "x": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 8}),
                              "y": ("INT", {"default": 0, "min": 0, "max": MAX_RESOLUTION, "step": 8}),
                              }}
    RETURN_TYPES = ("LATENT",)
    FUNCTION = "crop"

    CATEGORY = "latent/transform"

    def crop(self, samples, width, height, x, y):
        s = samples.copy()
        samples = samples['samples']

View on GitHub (pinned to ae05379cc9)

Solutions

  1. Set blend_mode='normal' and use blend_factor to control the mix (samples1*f + blended*(1-f)).
  2. If you need add/multiply/screen blending of latents, do it manually: samples_out['samples'] = samples1 * a + samples2 * b.
  3. Use the image-space Blend node (external_post_processing) which supports multiply/screen/overlay/soft_light/difference, applying it after VAE decode.
  4. Patch blend_mode() locally to implement the missing modes if your fork allows it.

Example fix

# before
blend_mode: str = 'add'  # ValueError in LatentBlend

# after
blend_mode: str = 'normal'  # only supported value; use blend_factor for strength
Defensive patterns

Strategy: validation

Validate before calling

if blend_mode != 'normal':
    raise ValueError(f'LatentBlend supports only "normal", got {blend_mode!r}')

Type guard

def is_supported_latent_blend(mode: str) -> bool:
    return mode == 'normal'

Try / catch

try:
    out = latent_blend.blend(samples1, samples2, blend_mode, blend_factor)
except ValueError as e:
    if 'blend mode' in str(e):
        out = latent_blend.blend(samples1, samples2, 'normal', blend_factor)
    else:
        raise

Prevention

When it happens

Trigger: Wiring a LatentBlend node with blend_mode='add'/'multiply'/'screen' etc., or passing an empty string. Only blend_mode='normal' passes.

Common situations: Porting workflows from ComfyUI upstream where more blend modes exist, or assuming parity with the image-domain Blend node which supports multiply/screen/overlay (see external_post_processing.Blend). A saved workflow JSON with mode='add' fails on load-and-run here.

Related errors


AI-assisted analysis of lllyasviel/Fooocus@ae05379cc9 (2026-08-15). Data as JSON: /api/errors/a459485c74b8e7f3. Report an issue: GitHub.