Stable Diffusion Black Images and NaN Error
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. Force full-precision VAE
- Edit webui-user.bat
- Set COMMANDLINE_ARGS=--no-half-vae
- Restart the web UI
Did this fix it?2. If NaNs come from the Unet
- Add --no-half as well (uses more VRAM)
- Or try --upcast-sampling first on cards that support it
Did this fix it?3. SDXL specific
- Use the fp16-fixed SDXL VAE (sdxl-vae-fp16-fix) in Settings > Stable Diffusion > SD VAE
- 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 usThe same problem in other apps
All ai & editing tools not working guides →
Leonardo.ai Tokens Ran Out: Why and What to Do (Leonardo.ai)
Other Stable Diffusion errors
- Stable Diffusion CUDA Out of Memory Error
- Stable Diffusion "Torch is not able to use GPU" Error
- Stable Diffusion Model Failed to Load, Exiting
- Stable Diffusion Very Slow on Mac (M1, M2, M3)
- Stable Diffusion Not Using AMD GPU (Slow, CPU Only)
- Stable Diffusion xformers Error After Update
- Stable Diffusion "Couldn't install torch" Error
- Stability AI API 402 Insufficient Credits Error