Fix ComfyUI GGUF Loader and Missing Node Errors
Missing Node Types: UnetLoaderGGUF, DualCLIPLoaderGGUF | (IMPORT FAILED): ComfyUI-GGUF -> ModuleNotFoundError: No module named 'gguf' | SafetensorError: Error while deserializing header on .gguf file Loading a low-VRAM GGUF workflow for Wan 2.2, FLUX.1, or Qwen-Image lights up red missing UnetLoaderGGUF or CLIPLoaderGGUF boxes, fails on startup with ComfyUI-GGUF IMPORT FAILED, or throws a safetensors header deserialization crash when you try selecting a .gguf file inside stock UNETLoader.
Core ComfyUI loaders only deserialize .safetensors and PyTorch archives, not llama.cpp-style .gguf quantized tensors. Running GGUF models requires installing city96/ComfyUI-GGUF, installing gguf>=0.13.0 strictly into ComfyUI own Python interpreter (not global system pip), and placing .gguf weights inside models/unet/ or models/diffusion_models/.
Copy-Paste Verified Fix
#!/usr/bin/env bash
set -euo pipefail
# Set COMFY_DIR and COMFY_PYTHON to match YOUR exact ComfyUI installation
COMFY_DIR="${1:-./ComfyUI}"
COMFY_PYTHON="${2:-$COMFY_DIR/venv/bin/python}"
# 1. Clone or update city96/ComfyUI-GGUF inside custom_nodes/
if [ -d "$COMFY_DIR/custom_nodes/ComfyUI-GGUF/.git" ]; then
git -C "$COMFY_DIR/custom_nodes/ComfyUI-GGUF" pull --ff-only
else
git clone https://github.com/city96/ComfyUI-GGUF "$COMFY_DIR/custom_nodes/ComfyUI-GGUF"
fi
# 2. Install/upgrade gguf>=0.13.0 strictly inside ComfyUI Python (never bare system pip!)
# Windows Portable equivalent:
# .\python_embeded\python.exe -s -m pip install -U gguf sentencepiece protobuf
"$COMFY_PYTHON" -m pip install -U -r "$COMFY_DIR/custom_nodes/ComfyUI-GGUF/requirements.txt"
# 3. Verify gguf version inside ComfyUI Python before restarting server
"$COMFY_PYTHON" -c "import gguf; print('ComfyUI Python gguf OK:', gguf.__file__)"
# 4. Ensure GGUF files sit in the right directories (NEVER models/checkpoints/):
# Diffusion .gguf (Wan 2.2 / FLUX / Qwen-Image) -> ComfyUI/models/diffusion_models/ (or models/unet/)
# Text Encoder .gguf (T5-XXL / UMT5-XXL) -> ComfyUI/models/text_encoders/
ls -lh "$COMFY_DIR/models/diffusion_models/"*.gguf "$COMFY_DIR/models/unet/"*.gguf 2>/dev/null || true Before vs. After (Broken Pattern vs. Verified Fix)
# Wrong Python environment + wrong loader node + wrong directory:
pip install gguf # Installs to global Python, NOT ComfyUI!
mv wan2.2-Q4_K_M.gguf ComfyUI/models/checkpoints/ # Invisible to UnetLoaderGGUF
# Graph uses stock "class_type": "UNETLoader" -> SafetensorError crash! # 1. Install plugin + gguf>=0.13.0 into ComfyUI EXACT Python interpreter:
git clone https://github.com/city96/ComfyUI-GGUF ComfyUI/custom_nodes/ComfyUI-GGUF
# Linux/macOS venv:
./venv/bin/python -m pip install -U -r ComfyUI/custom_nodes/ComfyUI-GGUF/requirements.txt
# Windows Portable (run from ComfyUI_windows_portable parent folder):
# .\python_embeded\python.exe -s -m pip install -U -r ComfyUI\custom_nodes\ComfyUI-GGUF\requirements.txt
# 2. Place .gguf diffusion weights in models/diffusion_models/ (or models/unet/) & use UnetLoaderGGUF Why this works: Targeting ComfyUI exact Python executable installs gguf>=0.13.0 where the server imports it, while pairing UnetLoaderGGUF with models/diffusion_models/ decodes Q4_K_M through Q8_0 tensors cleanly.
Why This Failure Happens in Real Pipelines
GGUF (GPT-Generated Unified Format) stores K-quantized 4-bit, 5-bit, 6-bit, and 8-bit weights (such as Q4_K_M, Q5_K_M, and Q8_0) so 14B–20B models like Alibaba Wan 2.2 and Qwen-Image fit comfortably on 12 GB to 16 GB consumer GPUs. However, stock ComfyUI UNETLoader and CLIPLoader use safetensors and torch.load parsers—if you drop a .gguf file into diffusion_models and pick it inside stock UNETLoader, ComfyUI immediately crashes with SafetensorError because the binary GGUF magic header does not match safetensors JSON metadata.
Even after cloning city96/ComfyUI-GGUF into ComfyUI/custom_nodes/ComfyUI-GGUF, the #1 reason UnetLoaderGGUF stays red and missing is Python environment mismatch. On Windows Portable bundles, ComfyUI runs out of an isolated python_embeded/python.exe interpreter, while Linux and macOS installs run inside a dedicated venv or conda environment. Running bare pip install gguf in a standard terminal installs the gguf library into your global system Python, leaving ComfyUI embedded Python blind and printing (IMPORT FAILED): ModuleNotFoundError: No module named gguf on every boot.
Two secondary traps appear even after the node loads cleanly. First, older versions of the Python gguf package (below 0.13.0) fail to parse newer quantization block types and Wan 2.2 / Qwen-Image tensor naming schemes, throwing cryptic KeyError or unsupported quant type exceptions until upgraded via pip install -U gguf. Second, UnetLoaderGGUF scans models/unet/ and models/diffusion_models/ (while CLIPLoaderGGUF scans models/text_encoders/ and models/clip/)—dropping .gguf files into models/checkpoints/ leaves the GGUF loader dropdown completely blank.
Step-by-Step Resolution & Verification
- 01
Identify the exact Python binary launching ComfyUI
Inspect the first five lines of your ComfyUI startup log to copy the exact Python path (for example python_embeded\python.exe on Windows Portable or /path/to/venv/bin/python on Linux/macOS). Never assume global pip matches ComfyUI.
- 02
Install ComfyUI-GGUF and upgrade gguf>=0.13.0 in that exact environment
Clone city96/ComfyUI-GGUF into custom_nodes/ and run -m pip install -U -r requirements.txt using the ComfyUI Python executable. On Windows Portable always include the -s flag so embedded Python ignores user-site conflicts.
- 03
Move .gguf files into diffusion_models/ or text_encoders/ and swap nodes
Relocate diffusion .gguf files out of checkpoints/, restart ComfyUI completely, replace UNETLoader with UnetLoaderGGUF (and CLIPLoader with CLIPLoaderGGUF for GGUF text encoders), and confirm /object_info/UnetLoaderGGUF lists your files.
curl -s http://127.0.0.1:8188/object_info/UnetLoaderGGUF | python3 -c 'import json,sys; d=json.load(sys.stdin); print("Loaded UnetLoaderGGUF ->", d["UnetLoaderGGUF"]["input"]["required"]["unet_name"][0])' Loaded UnetLoaderGGUF -> ['wan2.2-i2v-14b-Q4_K_M.gguf', 'flux1-dev-Q6_K.gguf'] How to Prevent This Error From Recurring
Always install custom-node requirements through ComfyUI explicit Python binary
Running python_embeded\python.exe -s -m pip (Windows) or ./venv/bin/python -m pip (Linux/macOS) eliminates 90% of IMPORT FAILED custom-node crashes permanently.
Match quantization level to VRAM headroom before downloading GGUF files
Use Q4_K_M for 12 GB–16 GB GPUs (best speed-to-fidelity floor), Q6_K for 16 GB–24 GB GPUs (virtually indistinguishable from BF16), and avoid extreme Q2/Q3 quants that introduce facial waxiness and typography artifacts.
Keep VAEs in full BF16/FP32 safetensors even when running GGUF diffusion
Never quantize the VAE to 4-bit; VAEs are small (~300 MB–500 MB) and sensitive to precision loss, so always pair UnetLoaderGGUF with standard ae.safetensors or wan_2.1_vae.safetensors.
Troubleshooting FAQs
- Can I install ComfyUI-GGUF through ComfyUI Manager instead of git clone?
- Yes. Searching ComfyUI-GGUF by city96 inside ComfyUI Manager clones the repo and runs pip inside the active ComfyUI interpreter automatically. If Manager still logs IMPORT FAILED, run the explicit -m pip install -U gguf command from this playbook.
- Which GGUF quantization gives the best quality-to-VRAM ratio for Wan 2.2 and FLUX?
- Q4_K_M fits 14B models cleanly inside 12 GB–16 GB cards with minimal motion degradation, while Q5_K_M and Q6_K preserve nearly 100% of original BF16 lighting and texture fidelity on 16 GB–24 GB cards.
- Can I mix a GGUF diffusion model with a regular FP8 safetensors text encoder?
- Yes. UnetLoaderGGUF outputs a standard ComfyUI MODEL object, so you can pair it freely with stock DualCLIPLoader (t5xxl_fp8_e4m3fn_scaled.safetensors) and stock VAELoader (ae.safetensors or wan_2.1_vae.safetensors).
- Why does UnetLoaderGGUF still run slower than FP8 on an RTX 4090 or RTX 5090?
- GGUF dequantizes packed 4-bit/6-bit blocks on the fly during matmul without hardware FP8 Tensor Core acceleration. If you have 24 GB+ VRAM on an RTX 4090 or 5090, native fp8_e4m3fn runs faster than GGUF; reserve GGUF for fitting larger models onto 8 GB–16 GB cards.
- Why did my Windows Portable install say "No module named pip" when running python_embeded?
- Minimal portable builds occasionally omit pip or wheel wrappers. Run .\python_embeded\python.exe -m ensurepip or use ComfyUI Manager, and always check that you executed the command from the ComfyUI_windows_portable root directory.