ComfyUI HuggingFace HttpRequestException: Fix Hugging Face Model Download Failures
Fix ComfyUI HuggingFace HttpRequestException and related Hugging Face download errors by separating network, proxy, token, gated repo, cache, and model-folder problems.
If ComfyUI or a launcher reports HuggingFace HttpRequestException during a model download, do not reinstall ComfyUI first.
The error usually means the downloader could not complete a request to Hugging Face, or Hugging Face rejected the request because the repo is gated, private, renamed, or missing. Your Python environment may still be fine.
Quick Diagnosis
| What You See | Most Likely Cause | First Check |
|---|---|---|
| Progress stays at 0 bytes, then retries fail | Network, DNS, proxy, firewall, or unstable route | Open the exact file URL in a browser |
MaxRetryError, SSLError, or connection reset | TLS/proxy/security software problem | Test another network or proxy mode |
401 Unauthorized, 403 Forbidden, GatedRepoError, or RepositoryNotFoundError | Token, gated model approval, private repo, or wrong repo id | Log in to Hugging Face and open the repo page |
LocalEntryNotFoundError plus "cannot find requested files in the local cache" | Offline mode, missing cache, or failed previous download | Check internet access and Hugging Face cache settings |
| File downloaded manually but ComfyUI cannot see it | Wrong model folder or partial file | Check where to put safetensors |
| Download works in browser but not in ComfyUI | ComfyUI process does not inherit the proxy/token | Set env vars before launching ComfyUI |
Evidence from Real ComfyUI Failures
In the local Wonderful Launcher issue data, download_failed with HttpRequestException appeared across multiple stable app versions and was grouped under model_asset_loading.
The ComfyUI issue dataset shows the same family of failures in different wording:
MaxRetryErrorand SSL failures while downloading fromhuggingface.coCannot connect to host huggingface.co:443LocalEntryNotFoundErrorwhen the file is not in the local cache and the Hub cannot be reachedHfHubHTTPError/ unauthorized responses when a node tries to download from a gated or private repo- requests for mirror support or offline installation when large model downloads are unreliable
That is why this page treats the error as a download-path diagnosis first, not a "broken ComfyUI install" diagnosis.
Step 1: Test the Exact Hugging Face URL Outside ComfyUI
First find the URL or repo name in the log. It may look like one of these:
https://huggingface.co/owner/repo/resolve/main/model.safetensors
owner/repoOpen it in a browser on the same machine. Then test it from the terminal:
Invoke-WebRequest -Uri "https://huggingface.co" -UseBasicParsing -TimeoutSec 20For a specific file, use a HEAD request so you do not download a multi-gigabyte model just to test connectivity:
curl.exe -L -I "https://huggingface.co/owner/repo/resolve/main/model.safetensors"Interpret the result:
| Result | Meaning |
|---|---|
| Browser and terminal both fail | Network, DNS, firewall, proxy, or regional routing |
| Browser works, terminal fails | ComfyUI/Python process is not using the same proxy or trust settings |
| Login page or gated page appears | You need account access or an accepted model license |
| 404 on the file but repo page works | Wrong filename, branch, subfolder, or model path |
Step 2: Separate Network Errors from Permission Errors
Hugging Face's huggingface_hub library refines HTTP failures into errors such as RepositoryNotFoundError, GatedRepoError, RevisionNotFoundError, EntryNotFoundError, and HfHubHTTPError.
For ComfyUI users, the practical split is:
| Error Family | Treat It As | What To Do |
|---|---|---|
Timeout, connection reset, SSL error, HttpRequestException | Transport problem | Fix proxy, DNS, firewall, antivirus, or route |
401 Unauthorized | Missing or invalid token | Use a valid Hugging Face token |
403 Forbidden or GatedRepoError | Account lacks access | Accept the model terms on Hugging Face first |
RepositoryNotFoundError | Wrong/private repo or missing access | Verify repo id and token |
EntryNotFoundError | Wrong filename or subfolder | Check the file tree in the repo |
LocalEntryNotFoundError | Offline/cache miss | Disable offline mode or prefill the cache |
Do not solve 403 or gated-model errors by changing CUDA, Torch, or random Python packages. Those are access problems.
Step 3: Configure Proxy Before Launching ComfyUI
If your browser can reach Hugging Face only through a proxy, make sure the ComfyUI process also gets that proxy.
For a temporary PowerShell session:
$env:HTTP_PROXY = "http://127.0.0.1:7890"
$env:HTTPS_PROXY = "http://127.0.0.1:7890"
python main.pyFor a Windows portable .bat file, add the proxy before the embedded Python command:
set HTTP_PROXY=http://127.0.0.1:7890
set HTTPS_PROXY=http://127.0.0.1:7890
.\python_embeded\python.exe -s ComfyUI\main.py --windows-standalone-build
pauseReplace 7890 with the actual port used by your proxy tool.
If ComfyUI is launched by a desktop app, launcher, service, scheduled task, or terminal shortcut, set the proxy in the place that launches ComfyUI. Setting it in a different terminal window will not help the already-running process.
Step 4: Check Token and Gated Model Access
Some workflows and custom nodes download models from gated or private Hugging Face repos. In that case, a public browser URL may not be enough.
Check these in order:
- Open the Hugging Face repo page while logged in.
- Accept the model license or access request if the repo is gated.
- Create or use a token with permission to read that repo.
- Pass the token to the same process that launches ComfyUI.
For a temporary PowerShell session:
$env:HF_TOKEN = "hf_your_token_here"
python main.pyTo confirm the active Python can see the token:
python -c "import os; print('HF_TOKEN set:', bool(os.environ.get('HF_TOKEN')))"To confirm the active Python can authenticate through huggingface_hub:
python -c "import os; from huggingface_hub import HfApi; print(HfApi(token=os.environ['HF_TOKEN']).whoami()['name'])"If that command fails with an auth error, fix the token or account access before changing ComfyUI.
Step 5: Check Offline Mode and Hugging Face Cache
Hugging Face supports cache and offline behavior through environment variables such as HF_HOME, HF_HUB_CACHE, HF_TOKEN, and HF_HUB_OFFLINE.
Check what the active process sees:
python -c "import os; print('HF_HOME=', os.environ.get('HF_HOME')); print('HF_HUB_CACHE=', os.environ.get('HF_HUB_CACHE')); print('HF_HUB_OFFLINE=', os.environ.get('HF_HUB_OFFLINE'))"If HF_HUB_OFFLINE=1, Hub requests will fail unless the file is already cached. This can look like a download bug when the real issue is offline mode plus an empty cache.
Be careful with the cache:
- Do not edit files inside the Hugging Face cache manually.
- Do not delete the whole cache if you have many large models already downloaded.
- If one download was interrupted, remove only the partial file or redownload to a clean location.
Step 6: Use Manual Download Only When It Matches the Node
Manual download is a good fallback for normal model files such as .safetensors, .gguf, .pth, .bin, or .onnx.
Use this pattern:
- Download the file in a browser or download manager.
- Verify the file size is complete.
- Put it in the correct ComfyUI folder.
- Restart ComfyUI or refresh the model dropdown.
Common destinations:
| File Type | Common Folder |
|---|---|
Checkpoint .safetensors | ComfyUI/models/checkpoints/ |
| LoRA | ComfyUI/models/loras/ |
| VAE | ComfyUI/models/vae/ |
| ControlNet | ComfyUI/models/controlnet/ |
| Text encoder / CLIP | ComfyUI/models/text_encoders/ or models/clip/ |
| Flux diffusion model / UNet | ComfyUI/models/diffusion_models/ or models/unet/ |
| Upscaler | ComfyUI/models/upscale_models/ |
For the full folder map, use Where to Put Safetensors in ComfyUI.
Some custom nodes do not look in normal ComfyUI model folders. They may call hf_hub_download() and expect the file in the Hugging Face cache or in a node-specific folder. If manual placement does not work, read the node README before moving files around.
Step 7: Avoid Package Drift While Fixing Downloads
Do not start by reinstalling torch, transformers, or huggingface_hub unless the error clearly says an import or version requirement failed.
These are different problems:
| Log Message | Better Starting Point |
|---|---|
HttpRequestException, timeout, SSL, connection reset | Network/proxy/token/cache checks on this page |
huggingface-hub>=... is required | Dependency conflict, see ComfyUI Dependency Conflicts |
cannot import ... from huggingface_hub | Package version mismatch |
| File downloads but model dropdown is empty | Model folder issue |
| ComfyUI crashes after custom node install | Plugin import failed |
The safest order is:
- Preserve the working environment.
- Test the URL.
- Fix proxy/token/cache.
- Redownload or move only the missing model file.
- Change packages only when the log proves it is a package issue.
How Wonderful Launcher Helps
Wonderful Launcher is useful when model downloads are mixed with environment risk:
- it keeps logs tied to the specific package you launched
- it helps preserve existing models and workflows before repair
- it lets you separate stable and experimental ComfyUI packages
- it reduces the temptation to run random
pip installcommands in the wrong Python environment
If the file URL works but ComfyUI still cannot download or locate the model, use the launcher logs to capture the exact URL, target path, Python environment, and error family before changing dependencies.
Related Guides
- Download Models
- Where to Put Safetensors in ComfyUI
- ComfyUI Failed to Get Custom Node List
- ComfyUI Dependency Conflicts
- How to Fix ComfyUI Plugin Import Failed Errors
- Deployment Failed: Downloading the Resource Package
Source References
- Hugging Face Hub file download guide
- Hugging Face Hub file download API
- Hugging Face Hub environment variables
- Hugging Face Hub HTTP error utilities
- ComfyUI issue: connection issue downloading models from Huggingface
- ComfyUI issue: cannot connect to host huggingface.co
- ComfyUI issue: MaxRetryError downloading from huggingface.co
- ComfyUI issue: LocalEntryNotFoundError cache miss
Start with Wonderful Launcher if this issue touches your real ComfyUI environment. Use the docs to understand the fix, and use the app to inspect the machine you already have.
Download Wonderful LauncherDid this fix your issue?
Your answer helps prioritize verified ComfyUI repairs.