Account Issue: Persistent 401 Unauthorized Error on All Downloads

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,

1 Like

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

yes i was able to download that.

1 Like


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?

1 Like

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…:cold_face:
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

1 Like