Skip to content
,

ComfyUI Black Image Fix: Every Cause and the Exact Fix (2026)

8–12 minutes
Woman at a creator desk with a PC tower holding a card reading BLACK, hook Black image? Fixed

The workflow finishes and there is no error, but the Save Image node shows a solid black square. Or the preview looks fine while it samples, then turns black at the very end. This is one of the most common ComfyUI problems, and it is almost never your prompt.

In nearly every case, a number inside the model overflowed and became NaN (not a number). ComfyUI cannot turn NaN into a colour, so it saves black.

This guide shows how to confirm that, then walks through every cause in order of how often it happens, with the exact file or launch flag that fixes it.

TL;DR

  • Check the terminal for RuntimeWarning: invalid value encountered in cast. That means NaN, and the fixes below apply.
  • SDXL: use sdxl_vae_fp16_fix.safetensors with a Load VAE node, or launch with --fp32-vae (or --bf16-vae on RTX 30 and newer).
  • GTX 16-series (1650/1660): launch with --force-fp32. These cards do not handle fp16 reliably.
  • Wrong or empty VAE file: use the VAE that matches the model (SD1.5, SDXL and Flux all differ).
  • Black only after a change? Undo it: SageAttention, --fast, --force-fp16, extreme CFG or a new LoRA are the usual triggers.

New to ComfyUI? My ComfyUI beginner guide covers install, models, nodes and fixes in one place.

Step 0: Confirm It Is a NaN Problem

Look at the terminal window (or the console in ComfyUI Desktop) right after the black image is saved. If you see this line, you have NaN values:

RuntimeWarning: invalid value encountered in cast

It comes from the Save Image or Preview Image step, when ComfyUI converts the decoded image into 8-bit pixels. NaN values cannot be converted, so they end up as black.

Other clues that point the same way:

  • The live preview during sampling looks normal, and only the final image is black. The problem is then in the VAE decode, not the sampler.
  • The preview is black from the first step. The problem is in the model or sampler (precision, flags, CFG).
  • There is no red node and no traceback.

If you see a real error with a traceback instead, this is a different problem. Check CUDA out of memory, mat1 and mat2 shapes cannot be multiplied or my list of common ComfyUI errors and fixes.

Causes and Fixes at a Glance

Symptom Most likely cause Fix
SDXL, preview fine, final image black SDXL VAE overflows in fp16 sdxl_vae_fp16_fix or --fp32-vae
Any model, final image black Wrong, empty or broken VAE file Load the matching VAE
GTX 1650/1660, black every time Card cannot run fp16 reliably --force-fp32
Black right after enabling a speed option SageAttention, --fast, --force-fp16 Turn it off for that model
Black or burnt with very high CFG Sampler settings push values out of range Use the model’s recommended CFG
Black only with one LoRA Broken or wrong-family LoRA, very high strength Lower strength or remove it
Brand-new model, black in every setting Model not stable in fp16 yet Use bf16/fp32, update ComfyUI
Mac or AMD, black images Attention precision on that backend --force-upcast-attention or --force-fp32

Fix 1: The SDXL VAE fp16 Bug

This is the classic cause. The original SDXL VAE produces values that are too large for fp16 (half precision). On cards and settings where ComfyUI decodes in fp16, those values overflow, become NaN, and the image comes out black, even though sampling worked.

Pick one of these fixes:

  1. Use the fixed VAE (best). Download sdxl_vae_fp16_fix.safetensors from the madebyollin sdxl-vae-fp16-fix repository on Hugging Face. Put it in ComfyUI/models/vae/, add a Load VAE node, select the file, and connect its VAE output to the VAE Decode node instead of the checkpoint’s VAE output. It works with any SDXL-based checkpoint, including Pony and Illustrious models.
  2. Decode in a safer precision. Add --fp32-vae to your launch line. It uses a little more VRAM and decodes a bit slower. On RTX 30, 40 and 50 cards, --bf16-vae is a good middle ground: bf16 has the same range as fp32, so it does not overflow.
  3. Decode on the CPU. --cpu-vae always works but is slow. Use it only to test.

Avoid --fp16-vae. ComfyUI’s own help text for that flag says it “might cause black images”.

Not sure where to add launch flags? For the portable build, edit run_nvidia_gpu.bat and add them at the end of the python main.py line. In ComfyUI Desktop, use Server Config in the settings. My ComfyUI command line arguments guide lists them all.

Fix 2: Wrong, Broken or Empty VAE

A VAE from the wrong model family, or a file that did not download properly, can decode to black or to noise.

Model family Correct VAE
SD 1.5 Built into most checkpoints, or vae-ft-mse-840000-ema-pruned.safetensors
SDXL, Pony, Illustrious sdxl_vae.safetensors or sdxl_vae_fp16_fix.safetensors
Flux.1 ae.safetensors
Newer models (Flux.2, Qwen-Image, Wan, MiniMax H3) The VAE named in that model’s official ComfyUI template

Also check:

  • File size. A VAE is usually 160-340 MB. A file of a few KB is an error page saved by the browser, not a model. Download it again.
  • The right output is connected. If you added a Load VAE node, make sure VAE Decode actually uses it and not the checkpoint’s VAE.
  • Baked-in VAE problems. Some merged SDXL checkpoints ship with the original, overflow-prone VAE. The fix VAE from Fix 1 solves this too.

My model folders cheat sheet shows exactly where each file goes.

Fix 3: GTX 16-Series and Older Cards

The GTX 1650, 1660, 1660 Super and 1660 Ti are known for unreliable fp16 results in Stable Diffusion. The tell is black images on every model, every time, even with the fixed VAE.

Launch ComfyUI with:

python main.py --force-fp32

That runs the model, text encoder and VAE in full precision. Generation is slower and uses more VRAM, so pair it with smaller models (SD1.5 or a small GGUF) and lower resolutions.

If you plan to do much image or video work, a card with more VRAM and proper fp16/bf16 support will make a huge difference. My how much VRAM you need for AI guide covers the options.

Fix 4: A Speed Flag or Attention Package

If images were fine yesterday and black today, think about what you changed. Speed options trade a little numerical safety for speed, and some models do not tolerate that.

  • SageAttention. If black images started after adding --use-sage-attention, remove the flag and test again. If only one model is affected, keep the flag off and use a per-workflow patch node (such as KJNodes “Patch Sage Attention”) for the models where it works. A wheel built for a different PyTorch or CUDA version can also cause this.
  • --fast. It enables fp16 accumulation and other test optimizations. Try --fast with only some of its options, or remove it.
  • --force-fp16. Forcing fp16 on a model that is meant to run in bf16 is a common way to get NaN. Remove it and let ComfyUI choose.
  • Old custom attention or precision patches. Some speed-up node packs patch the model. Bypass them (Ctrl+B) to test.

My speed up ComfyUI guide lists safer ways to get speed, and my SageAttention install guide shows how to match the wheel to your setup.

Fix 5: Sampler, CFG and LoRA Settings

Settings far outside what the model expects can push values out of range.

  • CFG. For normal SD1.5 and SDXL models, stay around 5-8. Turbo, Lightning and distilled models want CFG 1-2. For Flux.1 dev, keep the KSampler CFG at 1.0 and set guidance with the FluxGuidance node instead.
  • Steps and scheduler. One step on a non-distilled model, or a sampler and scheduler the model was not made for, can give black or grey results. Check the model card.
  • LoRAs. Disable LoRAs one at a time. A LoRA from another model family, a corrupted download or a strength far above 1.0 can break the output.
  • Denoise. In img2img, a denoise of 0 returns the input unchanged; with an empty latent that looks like a flat grey or black image. Use a value above 0.

Fix 6: New Models and fp16

Some new models are not stable in fp16 at release. For example, Z-Image Base has a known black-image issue in fp16 (ComfyUI issue #13123), while Z-Image Turbo works in the same workflow. If a brand-new model gives black images in every setting:

  1. Update ComfyUI. Fixes for new models often arrive within days.
  2. Run it in bf16 (on RTX 30 and newer) or fp32 instead of fp16.
  3. Check the model’s GitHub issues and the ComfyUI issue tracker for that model name.
  4. Try a different quant. A GGUF or fp8 file from another uploader sometimes works when one file does not.

Some models also ship a separate fix. For MOSS-Image, the MOSS-Image-heal guide covers its fp16 black images.

Fix 7: AMD, Intel and Mac

  • Apple Silicon (MPS). Try --force-upcast-attention first. If that does not help, use --force-fp32. ComfyUI’s own help text for the upcast flag asks users to report if it fixes black images, so it is a known lever.
  • AMD (ROCm or ZLUDA). Try --force-upcast-attention, then --fp32-vae, then --force-fp32. Make sure your ROCm and PyTorch versions match; my AMD GPU for AI guide covers setup.
  • Intel Arc. Update to the latest PyTorch XPU build and try --fp32-vae.

Black Frames in Video Workflows

Video models (Wan, HunyuanVideo, LTX, MiniMax H3) go black for the same reasons, plus a few of their own:

  • Use the video model’s own VAE, and the exact VAE file named in its template.
  • Use tiled VAE decode for long or high-resolution clips. It lowers VRAM use; a decode that silently fails on memory can produce black frames.
  • Turn off SageAttention and TeaCache-style caching to test. Both are common with video and both can break some models.
  • Check frame count rules. Many video models need a specific frame count (for example 4n+1). The template shows the allowed values.

FAQ

Why is the preview fine but the saved image black?

The sampler worked, but the VAE decode overflowed. Use the SDXL fp16 fix VAE or launch with --fp32-vae or --bf16-vae.

Does –fp32-vae slow everything down?

Only the final decode step, and only a little. Sampling speed is unchanged.

Is a black image a sign my GPU is failing?

Almost never. It is a precision or settings problem. A failing GPU usually causes crashes, driver resets or random artifacts instead.

Can I recover an image that already came out black?

No. The saved file holds no picture data. Apply the fix and run the same seed again to get the image you expected.

Why does the same workflow work on my friend’s PC?

Different GPUs and launch flags pick different precisions. An RTX 40 card may run in bf16 where a GTX 1660 runs in fp16 and overflows.

Sources

Free weekly email

Get new AI guides every week

One short weekly email with our newest local AI, ComfyUI and AI tool guides. No spam, no pop-ups, just the good stuff.

Free. Unsubscribe anytime in one click. We only use your email to send this newsletter. See our privacy policy.

Woman at a creator desk with a PC tower holding a card reading BLACK, hook Black image? Fixed