# Account Issue: Persistent 401 Unauthorized Error on All Downloads

**URL:** <https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396>\
**Category:** 🤗Hub\
**Created:** [June 23, 2025, 2:24pm UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396 "2025-06-23T14:24:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ANDI404](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andi404/32/49947_2.png) [@ANDI404](https://discuss.huggingface.co/u/ANDI404)\
**Post date:** [June 23, 2025, 2:24pm UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396/1 "2025-06-23T14:24:17Z")

</div>

Hello,

I am a new user and I’m unable to download any models or datasets. Every attempt results in a `401 Client Error: Unauthorized` with the message `Invalid credentials in Authorization header`.

I have already performed extensive troubleshooting and believe this is an issue with my account’s authorization status on your backend. I have confirmed:

- I am using freshly generated ‘read’ access tokens that are verified to be correct.
- My local network, firewall, antivirus, and proxy settings are not the cause.
- Basic network connectivity to `huggingface.co` is successful.
- The error persists across all authentication methods (CLI, environment variables, `use_auth_token` argument).
- The error happens for every model and dataset I attempt to download.

Here is the **Request ID** from my most recent failed attempt, which I hope helps you find the request in your server logs: `Root-I-08595de1-5bf6e5b40e2ad0e5b35360b2-3a0f7e0e-1307-4aee-a80e-103450e4b0ca`

Could you please investigate why my account’s tokens are being consistently rejected?

Thank you for your help.

Best regards,

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 23, 2025, 2:51pm UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396/2 "2025-06-23T14:51:27Z")

</div>

One confirmation. Can you download the following link by clicking on it from your browser while logged into your account?

If you can, then there is a problem with the library or server for passing the token, or with the token itself. If you cannot, then it is definitely an account restriction. (No token is required to download the file below.)  
[https://huggingface.co/google-bert/bert-base-uncased/resolve/main/model.safetensors?download=true](https://huggingface.co/google-bert/bert-base-uncased/resolve/main/model.safetensors?download=true)

---

<div class="post-metadata">

**Author:** ![ANDI404](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andi404/32/49947_2.png) [@ANDI404](https://discuss.huggingface.co/u/ANDI404)\
**Post date:** [June 23, 2025, 3:49pm UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396/3 "2025-06-23T15:49:38Z")

</div>

yes i was able to download that.

---

<div class="post-metadata">

**Author:** ![ANDI404](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/andi404/32/49947_2.png) [@ANDI404](https://discuss.huggingface.co/u/ANDI404)\
**Post date:** [June 23, 2025, 3:53pm UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396/4 "2025-06-23T15:53:37Z")

</div>

![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/0/f/0f179e8342d7f931f3f3201f7cd80eba9f359b4c.png)  
ive tried a few times of creating a new token but to no joe at all… not sure if its something im doing wrong? i am logged in through chrome if that makes any diffrence?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [June 24, 2025, 2:35am UTC](https://discuss.huggingface.co/t/account-issue-persistent-401-unauthorized-error-on-all-downloads/160396/5 "2025-06-24T02:35:02Z")

</div>

Web browsers manage their own environments in complex ways behind the scenes, so it is best to think of them as separate environments from CLI. However, the fact that you can download files using a web browser suggests that this is not intentionally blocked.

Some errors can be identified immediately by their error code, but I think _the causes of 401 errors are the most diverse on Hugging Face_ in terms of error code…🥶  
It could be a network issue, or it could be a case where the keyboard shortcut ctrl+v (ctrl+p on Mac) for copying and pasting is malfunctioning. There also seem to be cases where caches such as `.netrc` are causing problems.

In your case, “Invalid token” means that the server understands that you are trying to pass a token, but the content does not look like a token.  
Personally, if the token doesn’t work even when hardcoded in the Python code, I think there might be an unknown bug. @Wauplin

> [@Error 401 Client Error: Unauthorized for url](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714):
>
> When using model card of my private speech recognition model with LM, I got this error: 401 Client Error: Unauthorized for url: [https://huggingface.co/api/models/taliai/tali-asr-with-lm/revision/main](https://huggingface.co/api/models/taliai/tali-asr-with-lm/revision/main) while the same model without lm works fine. Is there anything wrong on my model or model card or … Any help is appreciated.

> <https://github.com/huggingface/huggingface_hub/issues/2765>
>
> \### Describe the bug
> 
> Firstly I apologize if it's really basic or trivial, but I… don't seem to understand how to login
> I'm trying to login with the huggingface-cli login and it keeps giving me the following
> 
> \`\`\`
> huggingface-cli login --token \<THE\_TOKEN\>
> The token has not been saved to the git credentials helper. Pass \`add\_to\_git\_credential=True\` in this function directly or \`--add-to-git-credential\` if using via \`huggingface-cli\` if you want to set the git credential as well.
> Traceback (most recent call last):
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/utils/\_http.py", line 406, in hf\_raise\_for\_status
> response.raise\_for\_status()
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/requests/models.py", line 1024, in raise\_for\_status
> raise HTTPError(http\_error\_msg, response=self)
> requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/hf\_api.py", line 1633, in whoami
> hf\_raise\_for\_status(r)
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/utils/\_http.py", line 477, in hf\_raise\_for\_status
> raise \_format(HfHubHTTPError, str(e), response) from e
> huggingface\_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2 (Request ID: Root=1-678e5498-0b3b190044e69e0613e6cff6;d4ef20db-e33b-42cc-ac5c-5643c9e9b530)
> 
> Invalid username or password.
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/bin/huggingface-cli", line 8, in \<module\>
> sys.exit(main())
> ^^^^^^
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/commands/huggingface\_cli.py", line 57, in main
> service.run()
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/commands/user.py", line 153, in run
> login(
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/utils/\_deprecation.py", line 101, in inner\_f
> return f(\*args, \*\*kwargs)
> ^^^^^^^^^^^^^^^^^^
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/utils/\_deprecation.py", line 31, in inner\_f
> return f(\*args, \*\*kwargs)
> ^^^^^^^^^^^^^^^^^^
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/\_login.py", line 126, in login
> \_login(token, add\_to\_git\_credential=add\_to\_git\_credential)
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/\_login.py", line 404, in \_login
> token\_info = whoami(token)
> ^^^^^^^^^^^^^
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/utils/\_validators.py", line 114, in \_inner\_fn
> return fn(\*args, \*\*kwargs)
> ^^^^^^^^^^^^^^^^^^^
> File "/home/appsinacup/AlexStuff/ComfyUI/imgaienv/lib/python3.12/site-packages/huggingface\_hub/hf\_api.py", line 1635, in whoami
> raise HTTPError(
> requests.exceptions.HTTPError: Invalid user token. If you didn't pass a user token, make sure you are properly logged in by executing \`huggingface-cli login\`, and if you did pass a user token, double-check it's correct.
> \`\`\`
> 
> 
> also the token seems to work when testing it with 
> 
> \`\`\`
> curl -i https://huggingface.co/api/whoami-v2 \\
> -H "Authorization: Bearer \<THE TOKEN\>"
> HTTP/2 200
> content-type: application/json; charset=utf-8
> content-length: 382
> date: Mon, 20 Jan 2025 14:08:15 GMT
> x-powered-by: huggingface-moon
> cross-origin-opener-policy: same-origin
> referrer-policy: strict-origin-when-cross-origin
> x-request-id: Root=1-678e58cf-35223b3a7ca3d73215320b2d
> access-control-allow-origin: https://huggingface.co
> vary: Origin
> access-control-expose-headers: X-Repo-Commit,X-Request-Id,X-Error-Code,X-Error-Message,X-Total-Count,ETag,Link,Accept-Ranges,Content-Range,X-Xet-Access-Token,X-Xet-Token-Expiration,X-Xet-Refresh-Route,X-Xet-Cas-Url,X-Xet-Hash
> etag: W/"17e-uXTz1hbj/22y/TAql9VBBdqElGo"
> x-cache: Miss from cloudfront
> via: 1.1 e76c434a546615d1c8c0e096c588e7d4.cloudfront.net (CloudFront)
> x-amz-cf-pop: OTP50-P2
> x-amz-cf-id: 4T2TKFmHXP4ma4JeDw0sy4znD0ocV6p9kuv31krBlI0z4kSYbEGaaQ==
> 
> {"type":"user","id":"63dcf661f37111482522cda7","name":"propolys","fullname":"Alex","email":"alexander\_00012@yahoo.com","emailVerified":true,"canPay":false,"periodEnd":null,"isPro":false,"avatarUrl":"/avatars/eb4ec70ff9803cb66fab23117ff45b02.svg","orgs":\[\],"auth":{"type":"access\_token","accessToken":{"displayName":"Comfyread","role":"read","createdAt":"2025-01-20T13:02:07.690Z"}}}
> \`\`\`
> 
> Thank you for any help, and sorry again if it's a noob question
> 
> \### Reproduction
> 
> \_No response\_
> 
> \### Logs
> 
> \`\`\`shell
> 
> \`\`\`
> 
> \### System info
> 
> \`\`\`shell
> \- huggingface\_hub version: 0.27.1
> \- Platform: Linux-6.8.0-51-generic-aarch64-with-glibc2.39
> \- Python version: 3.12.3
> \- Running in iPython ?: No
> \- Running in notebook ?: No
> \- Running in Google Colab ?: No
> \- Running in Google Colab Enterprise ?: No
> \- Token path ?: /home/appsinacup/.cache/huggingface/token
> \- Has saved token ?: False
> \- Configured git credential helpers:
> \- FastAI: N/A
> \- Tensorflow: N/A
> \- Torch: 2.6.0.dev20241224+cu126
> \- Jinja2: 3.1.3
> \- Graphviz: N/A
> \- keras: N/A
> \- Pydot: 3.0.3
> \- Pillow: 11.1.0
> \- hf\_transfer: N/A
> \- gradio: N/A
> \- tensorboard: N/A
> \- numpy: 1.26.4
> \- pydantic: 2.10.3
> \- aiohttp: 3.11.10
> \- ENDPOINT: https://huggingface.co
> \- HF\_HUB\_CACHE: /home/appsinacup/.cache/huggingface/hub
> \- HF\_ASSETS\_CACHE: /home/appsinacup/.cache/huggingface/assets
> \- HF\_TOKEN\_PATH: /home/appsinacup/.cache/huggingface/token
> \- HF\_STORED\_TOKENS\_PATH: /home/appsinacup/.cache/huggingface/stored\_tokens
> \- HF\_HUB\_OFFLINE: False
> \- HF\_HUB\_DISABLE\_TELEMETRY: False
> \- HF\_HUB\_DISABLE\_PROGRESS\_BARS: None
> \- HF\_HUB\_DISABLE\_SYMLINKS\_WARNING: False
> \- HF\_HUB\_DISABLE\_EXPERIMENTAL\_WARNING: False
> \- HF\_HUB\_DISABLE\_IMPLICIT\_TOKEN: False
> \- HF\_HUB\_ENABLE\_HF\_TRANSFER: False
> \- HF\_HUB\_ETAG\_TIMEOUT: 10
> \- HF\_HUB\_DOWNLOAD\_TIMEOUT: 10
> \`\`\`
