{"record":{"id":"a459485c74b8e7f3","repo":"lllyasviel/Fooocus","slug":"unsupported-blend-mode-mode","errorCode":null,"errorMessage":"Unsupported blend mode: {mode}","messagePattern":"Unsupported blend mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"ldm_patched/contrib/external.py","lineNumber":1262,"sourceCode":"        samples_out = samples1.copy()\n        samples1 = samples1[\"samples\"]\n        samples2 = samples2[\"samples\"]\n\n        if samples1.shape != samples2.shape:\n            samples2.permute(0, 3, 1, 2)\n            samples2 = ldm_patched.modules.utils.common_upscale(samples2, samples1.shape[3], samples1.shape[2], 'bicubic', crop='center')\n            samples2.permute(0, 2, 3, 1)\n\n        samples_blended = self.blend_mode(samples1, samples2, blend_mode)\n        samples_blended = samples1 * blend_factor + samples_blended * (1 - blend_factor)\n        samples_out[\"samples\"] = samples_blended\n        return (samples_out,)\n\n    def blend_mode(self, img1, img2, mode):\n        if mode == \"normal\":\n            return img2\n        else:\n            raise ValueError(f\"Unsupported blend mode: {mode}\")\n\nclass LatentCrop:\n    @classmethod\n    def INPUT_TYPES(s):\n        return {\"required\": { \"samples\": (\"LATENT\",),\n                              \"width\": (\"INT\", {\"default\": 512, \"min\": 64, \"max\": MAX_RESOLUTION, \"step\": 8}),\n                              \"height\": (\"INT\", {\"default\": 512, \"min\": 64, \"max\": MAX_RESOLUTION, \"step\": 8}),\n                              \"x\": (\"INT\", {\"default\": 0, \"min\": 0, \"max\": MAX_RESOLUTION, \"step\": 8}),\n                              \"y\": (\"INT\", {\"default\": 0, \"min\": 0, \"max\": MAX_RESOLUTION, \"step\": 8}),\n                              }}\n    RETURN_TYPES = (\"LATENT\",)\n    FUNCTION = \"crop\"\n\n    CATEGORY = \"latent/transform\"\n\n    def crop(self, samples, width, height, x, y):\n        s = samples.copy()\n        samples = samples['samples']","sourceCodeStart":1244,"sourceCodeEnd":1280,"githubUrl":"https://github.com/lllyasviel/Fooocus/blob/ae05379cc97bc4361ec8b4ec90193dab21be763f/ldm_patched/contrib/external.py#L1244-L1280","documentation":"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).","triggerScenarios":"Wiring a LatentBlend node with blend_mode='add'/'multiply'/'screen' etc., or passing an empty string. Only blend_mode='normal' passes.","commonSituations":"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.","solutions":["Set blend_mode='normal' and use blend_factor to control the mix (samples1*f + blended*(1-f)).","If you need add/multiply/screen blending of latents, do it manually: samples_out['samples'] = samples1 * a + samples2 * b.","Use the image-space Blend node (external_post_processing) which supports multiply/screen/overlay/soft_light/difference, applying it after VAE decode.","Patch blend_mode() locally to implement the missing modes if your fork allows it."],"exampleFix":"# before\nblend_mode: str = 'add'  # ValueError in LatentBlend\n\n# after\nblend_mode: str = 'normal'  # only supported value; use blend_factor for strength","handlingStrategy":"validation","validationCode":"if blend_mode != 'normal':\n    raise ValueError(f'LatentBlend supports only \"normal\", got {blend_mode!r}')","typeGuard":"def is_supported_latent_blend(mode: str) -> bool:\n    return mode == 'normal'","tryCatchPattern":"try:\n    out = latent_blend.blend(samples1, samples2, blend_mode, blend_factor)\nexcept ValueError as e:\n    if 'blend mode' in str(e):\n        out = latent_blend.blend(samples1, samples2, 'normal', blend_factor)\n    else:\n        raise","preventionTips":["Pin blend_mode='normal' in saved latent-blend workflows for this vendored node.","Do richer blending manually on the raw tensors or in image space after VAE decode.","When importing ComfyUI workflows, audit node parameters that this fork implements partially."],"tags":["comfyui","latent-blend","blend-mode","fooocus"],"backgroundTag":null,"analyzedSha":"ae05379cc97bc4361ec8b4ec90193dab21be763f","analyzedAt":"2026-08-15T04:23:59.533Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}