# Huggingface-cli login issue

**URL:** <https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547>\
**Category:** Beginners\
**Created:** [January 20, 2025, 2:27pm UTC](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547 "2025-01-20T14:27:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![propolys](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@propolys](https://discuss.huggingface.co/u/propolys)\
**Post date:** [January 20, 2025, 2:27pm UTC](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547/1 "2025-01-20T14:27:46Z")

</div>

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

```auto
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

```auto
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

### System info

```auto
- 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

```

---

<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:** [January 20, 2025, 2:40pm UTC](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547/2 "2025-01-20T14:40:45Z")

</div>

huggingface\_hub is also the latest version, and the procedure doesn’t seem to be wrong. Even if the token itself is fine-grained rather than read or write, there shouldn’t be a problem with logging in…  
If it’s an SSL error, the authentication by requests won’t go through either.  
It’s not impossible that there is a common case where HF\_TOKEN is set somewhere and that takes priority, but it’s not in the list of environment variables. What is this phenomenon…?🤔

> <https://github.com/huggingface/huggingface_hub/issues/2586>
>
> \### Describe the bug
> 
> I got access to Llama-3.2 but when I tried to access the… model, I got the 401 Error.
> 
> \`\`\`
> OSError: You are trying to access a gated repo.
> Make sure to have access to it at https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct.
> 401 Client Error. (Request ID: Root=1-66fc667a-79545df845c9253539ea509f;f6f84d32-d328-45e5-b78d-96461057d7d0)
> 
> Cannot access gated repo for url https://huggingface.co/meta-llama/Llama-3.2-1B-Instruct/resolve/main/config.json.
> Access to model meta-llama/Llama-3.2-1B-Instruct is restricted. You must have access to it and be authenticated to access it. Please log in.
> \`\`\`
> 
> Now this means either I don't have access to 3.2B or I am not logged in. I got approved access, so it's not the first one (more about this in Reproduction).
> 
> I added my HF token key using \`huggingface-cli login\`, but I am still facing the same issue after that.
> 
> I tried to debug and found that the command \`huggingface-cli whoami\` gives me this error - 
> \`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. {"error":"Invalid username or password."}\`
> 
> So, basically even if I login (either via CLI or in code), I am getting this error
> 
> \`\`\`
> from huggingface\_hub import login
> login(token = "xxx")
> \`\`\`
> 
> \*\*Note:\*\* The only change I made (from yesterday when Llama-2 is working to today) is to change some environment variables i.e
> \`\`\`
> export HF\_HOME=xxx
> export HF\_ASSETS\_CACHE=xxx
> export XDG\_CACHE\_HOME=xxx
> export HF\_TOKEN=xxx
> export HF\_HUB\_CACHE=xxx
> \`\`\`
> 
> \### Reproduction
> 
> I also experimented with \`Llama-2-7B\` (which I used till yesterday and it was fine) but was getting the same \`GatedError\`.
> 
> \`\`\`
> from transformers import AutoTokenizer
> import transformers
> import torch
> 
> from huggingface\_hub import login
> login(token = "xxx")
> 
> model = "meta-llama/Llama-2-7b-chat-hf"
> 
> tokenizer = AutoTokenizer.from\_pretrained(model)
> pipeline = transformers.pipeline(
> "text-generation",
> model=model,
> torch\_dtype=torch.float16,
> device\_map="auto",
> )
> 
> sequences = pipeline(
> 'I liked "Breaking Bad" and "Band of Brothers". Do you have any recommendations of other shows I might like?\\n',
> do\_sample=True,
> top\_k=10,
> num\_return\_sequences=1,
> eos\_token\_id=tokenizer.eos\_token\_id,
> max\_length=200,
> )
> for seq in sequences:
> print(f"Result: {seq\['generated\_text'\]}")
> \`\`\`
> \### Logs
> 
> \`\`\`
> 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.
> Token is valid (permission: fineGrained).
> Your token has been saved to /qumulo/satya/huggingface/token
> Login successful
> Traceback (most recent call last):
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/utils/\_http.py", line 406, in hf\_raise\_for\_status
> response.raise\_for\_status()
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/requests/models.py", line 1021, in raise\_for\_status
> raise HTTPError(http\_error\_msg, response=self)
> requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/meta-llama/Llama-2-7b-chat-hf/resolve/main/config.json
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/utils/hub.py", line 403, in cached\_file
> resolved\_file = hf\_hub\_download(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/utils/\_deprecation.py", line 101, in inner\_f
> return f(\*args, \*\*kwargs)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/utils/\_validators.py", line 114, in \_inner\_fn
> return fn(\*args, \*\*kwargs)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 1232, in hf\_hub\_download
> return \_hf\_hub\_download\_to\_cache\_dir(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 1339, in \_hf\_hub\_download\_to\_cache\_dir
> \_raise\_on\_head\_call\_error(head\_call\_error, force\_download, local\_files\_only)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 1854, in \_raise\_on\_head\_call\_error
> raise head\_call\_error
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 1746, in \_get\_metadata\_or\_catch\_error
> metadata = get\_hf\_file\_metadata(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/utils/\_validators.py", line 114, in \_inner\_fn
> return fn(\*args, \*\*kwargs)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 1666, in get\_hf\_file\_metadata
> r = \_request\_wrapper(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 364, in \_request\_wrapper
> response = \_request\_wrapper(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/file\_download.py", line 388, in \_request\_wrapper
> hf\_raise\_for\_status(response)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/huggingface\_hub/utils/\_http.py", line 423, in hf\_raise\_for\_status
> raise \_format(GatedRepoError, message, response) from e
> huggingface\_hub.errors.GatedRepoError: 401 Client Error. (Request ID: Root=1-66fc6aa2-51edf73166f9906f2c6e4de2;44b58636-df14-4a1a-bb9c-4d83423f68ed)
> 
> Cannot access gated repo for url https://huggingface.co/meta-llama/Llama-2-7b-chat-hf/resolve/main/config.json.
> Access to model meta-llama/Llama-2-7b-chat-hf is restricted. You must have access to it and be authenticated to access it. Please log in.
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "/qumulo/satya/Compress\_Align/scratch\_code/pytorch\_test.py", line 15, in \<module\>
> tokenizer = AutoTokenizer.from\_pretrained(model)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/models/auto/tokenization\_auto.py", line 864, in from\_pretrained
> config = AutoConfig.from\_pretrained(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/models/auto/configuration\_auto.py", line 1006, in from\_pretrained
> config\_dict, unused\_kwargs = PretrainedConfig.get\_config\_dict(pretrained\_model\_name\_or\_path, \*\*kwargs)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/configuration\_utils.py", line 567, in get\_config\_dict
> config\_dict, kwargs = cls.\_get\_config\_dict(pretrained\_model\_name\_or\_path, \*\*kwargs)
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/configuration\_utils.py", line 626, in \_get\_config\_dict
> resolved\_config\_file = cached\_file(
> File "/qumulo/satya/anaconda3/envs/prune\_llm/lib/python3.9/site-packages/transformers/utils/hub.py", line 421, in cached\_file
> raise EnvironmentError(
> OSError: You are trying to access a gated repo.
> Make sure to have access to it at https://huggingface.co/meta-llama/Llama-2-7b-chat-hf.
> 401 Client Error. (Request ID: Root=1-66fc6aa2-51edf73166f9906f2c6e4de2;44b58636-df14-4a1a-bb9c-4d83423f68ed)
> 
> Cannot access gated repo for url https://huggingface.co/meta-llama/Llama-2-7b-chat-hf/resolve/main/config.json.
> Access to model meta-llama/Llama-2-7b-chat-hf is restricted. You must have access to it and be authenticated to access it. Please log in.
> \`\`\`
> 
> \### System info
> 
> \`\`\`shell
> \- huggingface\_hub version: 0.25.1
> \- Platform: Linux-5.15.0-1065-nvidia-x86\_64-with-glibc2.35
> \- Python version: 3.9.19
> \- Running in iPython ?: No
> \- Running in notebook ?: No
> \- Running in Google Colab ?: No
> \- Running in Google Colab Enterprise ?: No
> \- Token path ?: /qumulo/satya/huggingface/token
> \- Has saved token ?: True
> \- Configured git credential helpers: 
> \- FastAI: N/A
> \- Tensorflow: N/A
> \- Torch: 2.4.1
> \- Jinja2: 3.1.4
> \- Graphviz: N/A
> \- keras: N/A
> \- Pydot: N/A
> \- Pillow: N/A
> \- hf\_transfer: N/A
> \- gradio: N/A
> \- tensorboard: N/A
> \- numpy: 1.26.4
> \- pydantic: 2.9.2
> \- aiohttp: 3.10.8
> \- ENDPOINT: https://huggingface.co
> \- HF\_HUB\_CACHE: /qumulo/satya/huggingface
> \- HF\_ASSETS\_CACHE: /qumulo/satya/huggingface
> \- HF\_TOKEN\_PATH: /qumulo/satya/huggingface/token
> \- 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
> \`\`\`

> <https://github.com/huggingface/huggingface_hub/issues/2507>
>
> \### Describe the bug
> 
> 
> So my issue is this error, I was working with same 'HF\_t…oken' having the write permission and I am working with Mistral Nemo 12B Instruct , the model was working well from last few days without any issue and today suddenly this error appears .
> This error appears to be persistant, i have refresh the token and also tried with other model too and also check the hugging face interface api server status as well, but the issue remains the same.
> 
> \### \*\*Issue\*\* 
> \*\*BadRequestError
> huggingface\_hub.utils.\_errors.BadRequestError: (Request ID: Mq1mDWKbogI0AleJS0HJM)\*\*
> 
> \*\*Bad request:
> Authorization header is correct, but the token seems invalid\*\*
> 
> This is my \`\`\`app.py\`\`\` file, and I have not modified or added any other files:
> 
> \`\`\`
> from huggingface\_hub import InferenceClient
> from dotenv import load\_dotenv
> 
> \# Load environment variables from .env file
> load\_dotenv()
> 
> \# Authenticate with Hugging Face
> HFT = os.getenv('HF\_TOKEN')
> client = InferenceClient(model="mistralai/Mistral-Nemo-Instruct-2407", token=HFT) 
> 
> \#results
> response = ""
> for message in client.chat\_completion(
> messages=\[system\_role, user\_prompt\],
> max\_tokens=3000,
> stream=True,
> temperature=0.35,
> ):
> response += message.choices\[0\].delta.content
> \`\`\`
> 
> 
> 
> \### Reproduction
> 
> \_No response\_
> 
> \### Logs
> 
> \`\`\`shell
> Traceback (most recent call last):
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\huggingface\_hub\\utils\\\_errors.py", line 304, in hf\_raise\_for\_status
> response.raise\_for\_status()
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\requests\\models.py", line 1024, in raise\_for\_status
> raise HTTPError(http\_error\_msg, response=self)
> requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api-inference.huggingface.co/models/mistralai/Mistral-Nemo-Instruct-2407/v1/chat/completions
> 
> The above exception was the direct cause of the following exception:
> 
> Traceback (most recent call last):
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 1498, in \_\_call\_\_
> return self.wsgi\_app(environ, start\_response)
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 1476, in wsgi\_app
> response = self.handle\_exception(e)
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 1473, in wsgi\_app
> response = self.full\_dispatch\_request()
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 882, in full\_dispatch\_request
> rv = self.handle\_user\_exception(e)
> File "C:\\Users\\Admin\\Documents\\\_app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 880, in full\_dispatch\_request
> rv = self.dispatch\_request()
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\flask\\app.py", line 865, in dispatch\_request
> return self.ensure\_sync(self.view\_functions\[rule.endpoint\])(\*\*view\_args) # type: ignore\[no-any-return\]
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\app5.py", line 78, in process\_file 
> per\_data = Model\_PersonalDetails\_Output(resume, client)
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\utility\\llm\_generate.py", line 127, in Model\_PersonalDetails\_Output
> for message in client.chat\_completion(
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\huggingface\_hub\\inference\\\_client.py", line 837, in chat\_completion
> data = self.post(
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\huggingface\_hub\\inference\\\_client.py", line 304, in post
> hf\_raise\_for\_status(response)
> File "C:\\Users\\Admin\\Documents\\app\_30082024\\envo\\lib\\site-packages\\huggingface\_hub\\utils\\\_errors.py", line 358, in hf\_raise\_for\_status
> raise BadRequestError(message, response=response) from e
> huggingface\_hub.utils.\_errors.BadRequestError: (Request ID: Mq1mDWKbogI0AleJS0HJM)
> 
> Bad request:
> Authorization header is correct, but the token seems invalid
> \`\`\`
> 
> 
> \### System info
> 
> \`\`\`shell
> \- huggingface\_hub version: 0.24.6
> \- Platform: Windows-10-10.0.19045-SP0
> \- Python version: 3.10.10
> \- Running in iPython ?: No
> \- Running in notebook ?: No
> \- Running in Google Colab ?: No
> \- Token path ?: C:\\Users\\Admin\\.cache\\huggingface\\token
> \- Has saved token ?: True
> \- FastAI: N/A
> \- Tensorflow: N/A
> \- Torch: 2.4.0
> \- Jinja2: 3.1.4
> \- Graphviz: N/A
> \- keras: N/A
> \- Pydot: N/A
> \- Pillow: 10.4.0
> \- hf\_transfer: N/A
> \- gradio: N/A
> \- tensorboard: N/A
> \- numpy: 1.26.4
> \- pydantic: N/A
> \- aiohttp: N/A
> \- ENDPOINT: https://huggingface.co
> \- HF\_HUB\_CACHE: C:\\Users\\Admin\\.cache\\huggingface\\hub
> \- HF\_ASSETS\_CACHE: C:\\Users\\Admin\\.cache\\huggingface\\assets
> \- HF\_TOKEN\_PATH: C:\\Users\\Admin\\.cache\\huggingface\\token
> \- 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
> \`\`\`

---

<div class="post-metadata">

**Author:** ![propolys](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@propolys](https://discuss.huggingface.co/u/propolys)\
**Post date:** [January 21, 2025, 11:36am UTC](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547/3 "2025-01-21T11:36:59Z")

</div>

i seemed to have in ~/.netrc credentials for [huggingface.co](http://huggingface.co), which i think they might have overridden my Authorization header.  
a smiple `rm ~/.netrc` did the trick

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](https://discuss.huggingface.co/u/system)\
**Post date:** [January 21, 2025, 11:37pm UTC](https://discuss.huggingface.co/t/huggingface-cli-login-issue/136547/4 "2025-01-21T23:37:30Z")

</div>

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
