Comfy-Org / Comfy-Org/ComfyUI_frontend
MaskEditor mask output corrupted when used with FLUX models — red paint baked into IMAGE, MASK not properly isolated
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
### Prerequisites
- [x] I am running the latest version of ComfyUI
- [x] I have custom nodes enabled
### What happened?
**Custom Node Testing**
✅I have tried disabling custom nodes and the issue persists
**Expected Behavior**
When painting a mask in MaskEditor on a LoadImage node, the red overlay should be a **visualization only**. The IMAGE output should contain the clean original image, and the MASK output should contain the isolated mask channel. Downstream nodes (InpaintModelConditioning, SetLatentNoiseMask, InpaintCropImproved, etc.) should receive a proper mask defining the inpaint region.
**Actual Behavior**
The MaskEditor's red/grey paint gets **baked into the IMAGE output** instead of remaining a separate mask layer. The MASK output is not properly isolated from the image data. This causes:
1. **Red paint:** Appears literally in the final output image. The model processes the red overlay as part of the image content rather than as a mask. For example, prompting "a bright blue circle" with a red-painted mask produces a **red ball** instead of a blue circle.
2. **Grey paint:** Partially works in some workflows but produces inconsistent results — models often return identical images with zero changes, as if no mask was provided.
3. **External masks work perfectly:** Loading a separate black/white mask image via a second LoadImage node → ImageToMask (channel: red) produces correct results every time. The mask routes properly, the model regenerates only the masked area, and the unmasked area stays pixel-perfect.
**Affected Models / Workflows**
Tested across multiple FLUX model families — all exhibit the same behavior:
- **FLUX 1 Fill Dev** (flux1-fill-dev.safetensors) with InpaintModelConditioning
- **FLUX 2 Dev** (flux2-dev.safetensors) with SetLatentNoiseMask
- **FLUX 1** Kontext (flux1-kontext-dev.safetensors) with InpaintCropImproved + InpaintModelConditioning + ReferenceLatent (CivitAI workflow by Daedalus_7)
All three work correctly with external mask images, all three fail with MaskEditor-painted masks.
**Additional Impact — Krita AI Plugin**
Since Krita AI uses ComfyUI as its backend and sends selection masks through the same pipeline, this bug also causes Krita AI's inpainting to fail silently with FLUX models. Kontext and Klein models in Krita AI produce identical input/output images, likely because the mask never reaches the model properly.
**Workaround**
Bypass MaskEditor entirely by creating masks externally:
1. Create a black/white mask image in any image editor (Krita, Paint, etc.) — white = area to inpaint, black = area to keep
2. Load it via a separate LoadImage node
3. Use ImageToMask node (channel: red) to convert to proper MASK type
4. Connect to the inpainting node's mask input instead of using LoadImage's built-in MASK output
This produces correct results consistently across all tested FLUX models.
Related Issues
- #12420 — MaskEditor fails to open entirely (500 error). Different symptom but both indicate MaskEditor instability in recent versions.
### Steps to Reproduce
**Steps to Reproduce**
**Test Case 1 — Red paint produces wrong output:**
1. Create any FLUX inpainting workflow (tested with FLUX 1 Fill, FLUX 2 Dev, FLUX 1 Kontext)
2. Load an image in LoadImage node
3. Right-click → Open in MaskEditor
4. Paint a region with the default red brush
5. Save and run the workflow
6. **Result:** Output image contains red paint in the masked area, or model treats red as image content
**Test Case 2 — Grey paint, zero difference:**
1. Same workflow as above
2. Paint with grey in MaskEditor instead of red
3. Run the workflow
4. **Result:** Output is identical to input — model behaves as if no mask was provided (particularly in Kontext inpainting workflow with InpaintCropImproved + Set/Get node routing)
**Test Case 3 — External mask works correctly:**
1. Same workflow, but disconnect the MASK output from LoadImage
2. Add a second LoadImage node, load a black/white mask image (white = inpaint area, black = keep)
3. Add an ImageToMask node (channel: red), connect: LoadImage → IMAGE → ImageToMask → MASK → downstream inpainting node
4. Run the workflow
5. **Result:** Inpainting works correctly. Model regenerates only the masked area, unmasked area preserved perfectly.
### How is this affecting you?
Feature doesn't work as expected
### ComfyUI Frontend Version
1.38.14
### Browser
Firefox
### Console Errors
```javascript
```
### Logs
```shell
```
### Additional Context
**Environment**
**OS:** Windows 11
**GPU:** NVIDIA RTX 5080
**CPU:** AMD Ryzen 9 9800X3D
**RAM:** 64GB DDR5 6000 MHz
**NVIDIA Driver:** 581.80
**ComfyUI Version:** Latest as of February 2026
**Browser:** Default
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-8936-MaskEditor-mask-output-corrupted-when-used-with-FLUX-models-red-paint-baked-into-IMA-30a6d73d36508161ac05d97c99863a6e) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.