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
- Remove startup options like
--fp16-vaeor--force-fp16from your startup file or from Manage → Startup Args if you set them. - Start ComfyUI with
--fp32-vaeso the VAE computes in full precision. Portable: append it to the line inrun_nvidia_gpu.bat. Manual:python main.py --fp32-vae. - If your card has little VRAM:
--cpu-vaecomputes only the VAE on the processor. It is slower, but reliable. - For SDXL, you can use the “SDXL-VAE-FP16-Fix” instead of the original VAE by placing it in
models\vaeand selecting it in the “Load VAE” node. It is adapted for fp16. - If black images only appear after installing an acceleration node, test with
--disable-all-custom-nodesto 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:
- Set up and maintain ComfyUI on Windows
Desktop or Portable, where the models belong, sharing models with other programs, safely installing custom nodes, updates, startup options … - Your First Image with ComfyUI
Install Comfy Desktop, learn the interface, and create your first AI image with FLUX.2 [small] 4B or Z-Image Turbo. - Your First AI Video with LTX in ComfyUI
Use LTX-2.3 in ComfyUI to create short videos with sound from text or an image. Template, files, settings, and license.
Terms for this
Similar errors
- AMD Radeon is not being used, PyTorch is running on the CPU
- CUDAExecutionProvider is not in available provider names (onnxruntime runs only on the CPU)
- hipErrorNoBinaryForGpu: Unable to find code object for all current devices! (ROCm has no matching code for your AMD card)
- Intel Arc not recognized (torch.xpu)
- no kernel image is available (graphics card does not match the PyTorch version)
Sources
- https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/cli_args.py
- https://github.com/Comfy-Org/ComfyUI/blob/master/comfy/model_management.py
- https://huggingface.co/madebyollin/sdxl-vae-fp16-fix
- https://docs.comfy.org/troubleshooting/custom-node-issues
Checked on Oct 21, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.