Stable Diffusion Black Images and NaN Error

Share
Workaround available Windows, Linux, macOS Updated November 14, 2026Based on 5 user reportsHow we research

Quick answer

Black or green images and 'A tensor with all NaNs was produced' come from half-precision math failing, most often in the VAE. Launch with --no-half-vae first, then --no-half if needed.

Most likely fix: Force full-precision VAE

How to fix it

Try these in order — the most common fix is first.

  1. 1. Force full-precision VAE

    1. Edit webui-user.bat
    2. Set COMMANDLINE_ARGS=--no-half-vae
    3. Restart the web UI
    Did this fix it?
  2. 2. If NaNs come from the Unet

    1. Add --no-half as well (uses more VRAM)
    2. Or try --upcast-sampling first on cards that support it
    Did this fix it?
  3. 3. SDXL specific

    1. Use the fp16-fixed SDXL VAE (sdxl-vae-fp16-fix) in Settings > Stable Diffusion > SD VAE
    2. Avoid --disable-nan-check: it only turns off the warning
    Did this fix it?

Symptoms

Output is a solid black or green image, or the UI shows 'NansException: A tensor with all NaNs was produced in Unet / VAE'.

Why it happens

  • fp16 precision overflow, especially the original SDXL VAE
  • GPU that does not support half precision well
  • Incompatible VAE or checkpoint
  • Using --disable-nan-check, which hides the error but leaves black images

This guide also covers

  • stable diffusion black images
  • a tensor with all nans was produced
  • stable diffusion green image

Still not working?

If Stable Diffusion keeps failing, you're not alone. See every Stable Diffusion problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us
Fixed it? Share this guide

The same problem in other apps

All ai & editing tools not working guides →

Other Stable Diffusion errors

All 10 Stable Diffusion errors and fixes →