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

Error / Models and files

Hugging Face: Cannot access gated repo (401)

The model is "gated" on Hugging Face: You must first accept the license and sign in with a token when downloading it.

The message

huggingface_hub.errors.GatedRepoError: 401 Client Error. Cannot access gated repo for url https://huggingface.co/…/resolve/main/… Access to model … is restricted. You must have access to it and be authenticated to access it. Please log in.

Affects: Hugging Face (Hub and hf CLI), ComfyUI, Wan2GP (WanGP), SwarmUI, InvokeAI

Why is this happening?

Some models (e.g. FLUX.1-dev or Llama) are protected. The download only works if you have accepted the terms in the browser and the program is signed in with your Hugging Face account. If either one is missing, the server responds with 401 or 403. For some models, the provider must approve your request manually first.

How to fix it

  1. Sign in to huggingface.co in your browser, open the model page, and click "Agree and send request to access repo". Fill out any additional fields if asked.
  2. Check on the model page whether access has already been approved. If it says the request is still being reviewed (pending), you have to wait for the provider to approve it.
  3. Create a token with the role "Read" at https://huggingface.co/settings/tokens using "New token". Treat the token like a password.
  4. Install the Hugging Face command line if it is not already installed, e.g. with pip install -U huggingface_hub (or with the official installer from the Hugging Face docs).
  5. Sign in in the terminal: hf auth login. Follow the link or paste your token. Use hf auth whoami to check whether the sign-in worked.
  6. Restart the program (e.g. ComfyUI or Wan2GP) so it uses the saved token, then start the download again. Alternatively, download the file directly with hf download <repo-id> <dateiname> --local-dir <zielordner>.

Better not: Do not download locked models from random mirror sites to bypass the sign-in, and do not share your token in forums or screenshots.

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.