Free | No tracking | Every fact with a source|German and English

Error / Graphics card and drivers

Black images or NaN values (VAE precision)

Generation runs to completion, but the result is a black image because invalid numbers (NaN) were created during computation.

The message

RuntimeWarning: invalid value encountered in cast … (Ergebnis ist ein komplett schwarzes Bild)

Affects: ComfyUI

Why is this happening?

If the VAE is computed in half precision (fp16), the numbers can overflow. The original SDXL VAE is known to produce NaN values in fp16. On GTX 16 cards (e.g. 1650, 1660), fp16 is so broken that ComfyUI automatically disables it there. If you force it anyway, for example with --fp16-vae or --force-fp16, black images will appear.

How to fix it

  1. Remove startup options like --fp16-vae or --force-fp16 from your startup file or from Manage → Startup Args if you set them.
  2. Start ComfyUI with --fp32-vae so the VAE computes in full precision. Portable: append it to the line in run_nvidia_gpu.bat. Manual: python main.py --fp32-vae.
  3. If your card has little VRAM: --cpu-vae computes only the VAE on the processor. It is slower, but reliable.
  4. For SDXL, you can use the “SDXL-VAE-FP16-Fix” instead of the original VAE by placing it in models\vae and selecting it in the “Load VAE” node. It is adapted for fp16.
  5. If black images only appear after installing an acceleration node, test with --disable-all-custom-nodes to see whether that node is the cause.

Set up from scratch again

If it still doesn’t work after that, a fresh setup step by step often helps:

Terms for this

Similar errors

Sources

Checked on Oct 21, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.