Cannot access gated repo for url
The message
Cannot access gated repo for urlWhat it means
The model's authors require people to request access before downloading, and the Hub didn't see an approved account behind your request: either no token was sent, or the account hasn't been let in.
What to do
Read the line under it. “You must be authenticated” means log in (hf auth login or HF_TOKEN); “not in the authorized list” means request access on the model page and wait for approval.
Here it is from a ComfyUI node's issue tracker, trying to download one of Meta's audio models:
401 Client Error. (Request ID: Root=1-694b8f13-0ee411fb60cc24cd54cbb1cb;61d98fc8-80ec-40d5-ade9-cf33cabe9563)
Cannot access gated repo for url https://huggingface.co/facebook/sam-audio-judge/resolve/cd52eb977697cc0b25d4ecd309a88d4af46223ee/.gitattributes.
Access to model facebook/sam-audio-judge is restricted. You must have access to it and be authenticated to access it. Please log in.
A "gated" repo is a public model whose authors make you ask first. Usually that means accepting a license. huggingface_hub raises GatedRepoError when the Hub marks a refusal as a gated one (we read this in 2.0.0, where the second line comes from the library and the third is the Hub's own words). If you're loading through transformers, it wraps the same thing in an OSError that starts You are trying to access a gated repo. About 730 GitHub issues mention GatedRepoError as of September 25, 2026.
Read the last line first
The status code and the Hub's sentence tell you which of two problems you have. On GitHub, 176 issues carry the "must have access to it and be authenticated" wording and 142 the "not in the authorized list" one, as of September 25, 2026. The wording shifts a bit from log to log. We saw three:
401withYou must be authenticated to access itorYou must have access to it and be authenticated to access it. Please log in.The request had no token, so the Hub can't tell whether you're approved.403withis restricted and you are not in the authorized list. Visit https://huggingface.co/... to ask for access.The Hub knows who you are, and that account hasn't been let in.
The fixes don't overlap. Logging in does nothing for a 403 (a new token for the same account gets the same answer).
Fixing the 401: send a token
Hugging Face's gated models page says scripts need a user token. Run hf auth login once on the machine or set the HF_TOKEN environment variable. Most loaders also take a token= argument, from_pretrained and hf_hub_download included. HF_TOKEN wins over a token saved on disk (the one hf auth login writes), so a stale value left in a shell profile can override a fresh login.
The usual trap is a token that's on your laptop but not where the code runs. A Docker container, a CI runner or a ComfyUI install under another user won't see it unless you hand it over. If you use a fine-grained token (one limited to chosen resources), the docs say it needs read access to that model.
Fixing the 403: ask, then wait
Access can only be requested in a browser. Log in, open the model page, fill in the form and click Agree (some authors ask for more than a name and email). Approval is automatic by default, so for most models it's instant. Some authors approve by hand. That "can take more time," in the docs' words, and you can't hurry it. Once the model page shows you have access, the same token starts working.
Two cases don't clear. If the authors reject a request, the docs say you can't ask again and the page reads Your request to access this repo has been rejected by the repo's authors. Authors can also pull access later, even after approving you. Access also belongs to the account. A token from a different one (a work org's service user, say) gets a 403 even if you were approved on your own.
When it says Repository Not Found instead
We didn't expect this one. In 2.0.0, a 401 on a repo address that isn't flagged as gated is reported as RepositoryNotFoundError (GatedRepoError is a subclass of it, for backward compatibility), and a comment in the code says that when you aren't logged in, the Hub answers 401 for a private or gated repo and for one that doesn't exist at all. So "Repository Not Found" for a model you can see in your browser often means the same missing token. Log in and try again before hunting for a typo.
Other lines the same feature prints
Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.
huggingface_hub.errors.GatedRepoError: 401 Client Error.huggingface_hub.errors.GatedRepoError: 403 Client Error.Access to model meta-llama/Meta-Llama-3-8B-Instruct is restricted. You must be authenticated to access it.Access to model facebook/sam-audio-judge is restricted. You must have access to it and be authenticated to access it. Please log in.Access to model krea/Krea-2-Raw is restricted and you are not in the authorized list. Visit https://huggingface.co/krea/Krea-2-Raw to ask for access.OSError: You are trying to access a gated repo.