# Error 401 Client Error: Unauthorized for url

**URL:** <https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714>\
**Category:** 🤗Hub\
**Created:** [June 28, 2022, 8:17am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714 "2022-06-28T08:17:42Z")\
**Posts on this page:** 20\
**Page:** 4

<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:** [March 12, 2025, 8:27am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/65 "2025-03-12T08:27:01Z")

</div>

I’m surprised you came up with such a workaround…😅

It seems that the token area is being modified, and the operation has changed twice today alone. Well, it’s probably best to wait for it to be fixed.

---

<div class="post-metadata">

**Author:** ![charliebaby2023](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/charliebaby2023/32/32137_2.png) [@charliebaby2023](https://discuss.huggingface.co/u/charliebaby2023)\
**Post date:** [March 12, 2025, 6:34pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/66 "2025-03-12T18:34:17Z")

</div>

i agree john  
i thought i was going crazy, but over the last 48 hours or so token procedures appear to change  
and yes, putting it into a secret worked for me for some models too, still.  
and yes, previously omitting tokens granted access for me as well.  
i cant confirm CAPPING tokens, not yet at least  
i cant really keep track of what i can and cant confirm or when

likely tomorrow itll change again eh?  
i need a nice tall glass of drink

---

<div class="post-metadata">

**Author:** ![ydNA00eel](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/ydna00eel/32/43666_2.png) [@ydNA00eel](https://discuss.huggingface.co/u/ydNA00eel)\
**Post date:** [March 20, 2025, 3:29am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/67 "2025-03-20T03:29:04Z")

</div>

yes this works (but I don’t know why the below cannot work for me:  
from huggingface\_hub import notebook\_login  
notebook\_login()

---

<div class="post-metadata">

**Author:** ![MengjieDeng](https://avatars.discourse-cdn.com/v4/letter/m/dfb087/32.png) [@MengjieDeng](https://discuss.huggingface.co/u/MengjieDeng)\
**Post date:** [March 27, 2025, 6:38am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/68 "2025-03-27T06:38:14Z")

</div>

thank you so much! it works for me

---

<div class="post-metadata">

**Author:** ![XPW123](https://avatars.discourse-cdn.com/v4/letter/x/a9adbd/32.png) [@XPW123](https://discuss.huggingface.co/u/XPW123)\
**Post date:** [June 12, 2025, 2:57pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/69 "2025-06-12T14:57:31Z")

</div>

I’m having a similar issue now and I’m downloading stabilityai/stable-diffusion-xl-base-1.0 encounter RuntimeError: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https:cas-server.xethub.hf.co/reconstruction/4cb12f8b6ebb11f02b908c4c878871cae90cbe3bad06db19e97336df6b7f3a6e I don’t understand why public repositories need authorization as well, and even if I give the correct token, it will still get an error, and I download other public models that don’t happen at the same time , I wouldn’t go wrong downloading the model on other PCs either

---

<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 12, 2025, 3:18pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/70 "2025-06-12T15:18:01Z")

</div>

Hmm… How about `pip install -U huggingface_hub[hf_xet]` ?

> [@Downloading larger models with xet fails on macOS](https://discuss.huggingface.co/t/downloading-larger-models-with-xet-fails-on-macos/158005/4):
>
> Hi @h4rz3rk4s3 - Xet team member here checking in hugs - sorry you’re encountering this! @John6666 is correct, the Too many open files (os error 24) you’re encountering should’ve been addressed in a recent set of releases. Could you tell me a bit more about your setup? Specifically: Network speed Disk setup Any HF\_XET\* environment variables (can see these by doing a env | grep "HF\_XET") Could you also provide a full error statement so we can better troubleshoot? To answer your question: …

---

<div class="post-metadata">

**Author:** ![alfredgabal](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@alfredgabal](https://discuss.huggingface.co/u/alfredgabal)\
**Post date:** [July 1, 2025, 12:40am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/71 "2025-07-01T00:40:50Z")

</div>

I’m getting the same error and I have hf-xet 1.1.5. I’m behind a firewall but have no problems with requests to other URLs.

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [July 1, 2025, 3:26pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/72 "2025-07-01T15:26:04Z")

</div>

> [@XPW123](#):
>
> Reqwest Error: HTTP status client error (401 Unauthorized)

Hi @XPW123 thanks for the report - are you behind any firewalls when you make this request? If so, could you make sure you have the following domains allowlisted:

```auto
cas-bridge.xethub.hf.co
transfer.xethub.hf.co
cas-server.xethub.hf.co

```

If not (or if that doesn’t help), could you [open an issue on the xet-core repository](https://github.com/huggingface/xet-core/issues/new?template=bug-report.yml) and we can investigate there?

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [July 1, 2025, 3:27pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/73 "2025-07-01T15:27:19Z")

</div>

Hi @alfredgabal 👋

Could you provide the full error you’re seeing?

Also, do you have the following URLs allowlisted:

```auto
cas-bridge.xethub.hf.co
transfer.xethub.hf.co
cas-server.xethub.hf.co

```

---

<div class="post-metadata">

**Author:** ![alfredgabal](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@alfredgabal](https://discuss.huggingface.co/u/alfredgabal)\
**Post date:** [July 1, 2025, 11:05pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/74 "2025-07-01T23:05:48Z")

</div>

> [@jsulz](#):
>
> `cas-bridge.xethub.hf.co`

Hi @jsulz , thanks for the reply. I do get a response when I curl those three URLs. Here’s the full error message (I replaced some “https” with “h\*\*\*s” because the page doesn’t let me post more than two links):

Fetching 83 files: 0%| | 0/83 [00:00\<?, ?it/s]{“timestamp”:“2025-07-01T17:37:59.153575Z”,“level”:“ERROR”,“fields”:{“message”:“error downloading range, error: ReqwestMiddlewareError(Middleware(error sending request\n\nCaused by:\n 0: client error (SendRequest)\n 1: connection error\n 2: peer closed connection without sending TLS close\_notify: h\*\*\*s://docs.rs/rustls/latest/rustls/manual/\_03\_howto/index.html#unexpected-eof))”,“caller”:“/home/runner/work/xet-core/xet-core/cas\_client/src/download\_utils.rs:528”},“filename”:“/home/runner/work/xet-core/xet-core/error\_printer/src/lib.rs”,“line\_number”:28}  
{“timestamp”:“2025-07-01T18:05:15.966119Z”,“level”:“WARN”,“fields”:{“message”:“Reqwest(reqwest::Error { kind: Request, source: hyper\_util::client::legacy::Error(SendRequest, hyper::Error(Io, Os { code: 104, kind: ConnectionReset, message: "Connection reset by peer" })) }). Retrying…”},“filename”:“/home/runner/work/xet-core/xet-core/cas\_client/src/http\_client.rs”,“line\_number”:242}  
{“timestamp”:“2025-07-01T18:05:15.970285Z”,“level”:“WARN”,“fields”:{“message”:“Retry attempt #0. Sleeping 2.750031341s before the next attempt”},“filename”:“/root/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/reqwest-retry-0.7.0/src/middleware.rs”,“line\_number”:171}

Fetching 83 files: 1%| | 1/83 [43:04\<58:51:31, 2584.04s/it]  
Fetching 83 files: 17%|█▋ | 14/83 [43:04\<3:32:15, 184.57s/it]  
{“timestamp”:“2025-07-01T18:06:30.649359Z”,“level”:“ERROR”,“fields”:{“message”:“error downloading range, error: ReqwestMiddlewareError(Middleware(error sending request\n\nCaused by:\n 0: client error (SendRequest)\n 1: connection error\n 2: peer closed connection without sending TLS close\_notify: h\*\*\*s://docs.rs/rustls/latest/rustls/manual/\_03\_howto/index.html#unexpected-eof))”,“caller”:“/home/runner/work/xet-core/xet-core/cas\_client/src/download\_utils.rs:528”},“filename”:“/home/runner/work/xet-core/xet-core/error\_printer/src/lib.rs”,“line\_number”:28}  
Traceback (most recent call last):  
File “/home/ag/Models/molmo-inference.py”, line 15, in   
model = AutoModelForCausalLM.from\_pretrained(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/models/auto/auto\_factory.py”, line 593, in from\_pretrained  
return model\_class.from\_pretrained(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/modeling\_utils.py”, line 311, in \_wrapper  
return func(\*args, \*\*kwargs)  
^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/modeling\_utils.py”, line 4674, in from\_pretrained  
checkpoint\_files, sharded\_metadata = \_get\_resolved\_checkpoint\_files(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/modeling\_utils.py”, line 1295, in \_get\_resolved\_checkpoint\_files  
checkpoint\_files, sharded\_metadata = get\_checkpoint\_shard\_files(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/utils/hub.py”, line 1110, in get\_checkpoint\_shard\_files  
cached\_filenames = cached\_files(  
^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/utils/hub.py”, line 557, in cached\_files  
raise e  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/transformers/utils/hub.py”, line 485, in cached\_files  
snapshot\_download(  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/utils/\_validators.py”, line 114, in \_inner\_fn  
return fn(\*args, \*\*kwargs)  
^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/\_snapshot\_download.py”, line 327, in snapshot\_download  
thread\_map(  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/tqdm/contrib/concurrent.py”, line 69, in thread\_map  
return \_executor\_map(ThreadPoolExecutor, fn, \*iterables, \*\*tqdm\_kwargs)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/tqdm/contrib/concurrent.py”, line 51, in \_executor\_map  
return list(tqdm\_class(ex.map(fn, \*iterables, chunksize=chunksize), \*\*kwargs))  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/tqdm/std.py”, line 1181, in **iter**  
for obj in iterable:  
^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/concurrent/futures/\_base.py”, line 619, in result\_iterator  
yield \_result\_or\_cancel(fs.pop())  
^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/concurrent/futures/\_base.py”, line 317, in \_result\_or\_cancel  
return fut.result(timeout)  
^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/concurrent/futures/\_base.py”, line 449, in result  
return self.\_\_get\_result()  
^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/concurrent/futures/\_base.py”, line 401, in \_\_get\_result  
raise self.\_exception  
File “/home/ag/conda/Molmo/lib/python3.12/concurrent/futures/thread.py”, line 59, in run  
result = self.fn(\*self.args, \*\*self.kwargs)  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/\_snapshot\_download.py”, line 301, in \_inner\_hf\_hub\_download  
return hf\_hub\_download(  
^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/utils/\_validators.py”, line 114, in \_inner\_fn  
return fn(\*args, \*\*kwargs)  
^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/file\_download.py”, line 1008, in hf\_hub\_download  
return \_hf\_hub\_download\_to\_cache\_dir(  
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/file\_download.py”, line 1161, in \_hf\_hub\_download\_to\_cache\_dir  
\_download\_to\_tmp\_and\_move(  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/file\_download.py”, line 1710, in \_download\_to\_tmp\_and\_move  
xet\_get(  
File “/home/ag/conda/Molmo/lib/python3.12/site-packages/huggingface\_hub/file\_download.py”, line 627, in xet\_get  
download\_files(  
RuntimeError: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: [https://cas-server.xethub.hf.co/reconstruction/c4ac4717bebd033e12a7f0036103c7383614198445be5970f0187fa2bfc0d9c3](https://cas-server.xethub.hf.co/reconstruction/c4ac4717bebd033e12a7f0036103c7383614198445be5970f0187fa2bfc0d9c3)

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [July 2, 2025, 7:11pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/75 "2025-07-02T19:11:23Z")

</div>

Thanks for the additional details! There is potentially some work we can do here on our authentication to the storage system backing these files.

I opened up an [issue here](https://github.com/huggingface/xet-core/issues/404) on the `xet-core` repo, since the issue can potentially be addressed there.

Feel free to add any additional context or subscribe to the issue there to get updates (I’ll also post here when we think we’ve resolved the issue).

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [July 11, 2025, 3:44pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/76 "2025-07-11T15:44:18Z")

</div>

Hey @alfredgabal - just wanted to let you know that we believe the root cause of this issue was not providing enough buffer between a token refresh and when that same token was set to expire. The PR for this is [here](https://github.com/huggingface/xet-core/pull/405) and will be included in our next release.

Thank you for reporting!

---

<div class="post-metadata">

**Author:** ![TeoTe](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/teote/32/47164_2.png) [@TeoTe](https://discuss.huggingface.co/u/TeoTe)\
**Post date:** [July 15, 2025, 10:47pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/77 "2025-07-15T22:47:45Z")

</div>

This occurs completely at random when using:  
[https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions](https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions)  
(Default for Gradio chatbot). Makes the whole thing unusable. Every second results in 401 and then at random it works. Shouldn’t not related to authorization in that case. Very bad issue.

What more I am using it directly via huggingface space.

---

<div class="post-metadata">

**Author:** ![reachy-mini-tutorial](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/reachy-mini-tutorial/32/51899_2.png) [@reachy-mini-tutorial](https://discuss.huggingface.co/u/reachy-mini-tutorial)\
**Post date:** [August 4, 2025, 1:15pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/78 "2025-08-04T13:15:27Z")

</div>

Just want to echo the above. I’m new to try Hugging Face space and I also used the Gradio chatbot template. For me the 401 error happens on every single attempt.

```auto
huggingface_hub.errors.HfHubHTTPError: 401 Client Error: Unauthorized for url: https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions 

```

More stack trace:

```auto

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gradio/queueing.py", line 622, in process_events
    response = await route_utils.call_process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/route_utils.py", line 323, in call_process_api
    output = await app.get_blocks().process_api(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 2016, in process_api
    result = await self.call_function(
  File "/usr/local/lib/python3.10/site-packages/gradio/blocks.py", line 1581, in call_function
    prediction = await utils.async_iteration(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 796, in asyncgen_wrapper
    response = await iterator. __anext__ ()
  File "/usr/local/lib/python3.10/site-packages/gradio/chat_interface.py", line 667, in _stream_fn
    first_response = await async_iteration(generator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 691, in async_iteration
    return await anext(iterator)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 685, in __anext__
    return await anyio.to_thread.run_sync(
  File "/usr/local/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
    return await get_async_backend().run_sync_in_worker_thread(
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2470, in run_sync_in_worker_thread
    return await future
  File "/usr/local/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 967, in run
    result = context.run(func, *args)
  File "/usr/local/lib/python3.10/site-packages/gradio/utils.py", line 668, in run_sync_iterator_async
    return next(iterator)
  File "/home/user/app/app.py", line 30, in respond
    for message in client.chat_completion(
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 842, in chat_completion
    data = self.post(model=model_url, json=payload, stream=stream)
  File "/usr/local/lib/python3.10/site-packages/huggingface_hub/inference/_client.py", line 305, in post
    hf_raise_for_status(response)
  File "/usr/local/lib/python3.10/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://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions (Request ID: Root=1-688a5344-50f1183c2473d25317effe51;3895cba8-31c5-4c70-89a9-423bebbd23d5)

```

---

<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:** [August 5, 2025, 12:37am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/79 "2025-08-05T00:37:23Z")

</div>

> [https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions](https://api-inference.huggingface.co/models/HuggingFaceH4/zephyr-7b-beta/v1/chat/completions)

I think [this format’s endpoint is either old or has been retained for compatibility reasons](https://discuss.huggingface.co/t/hf-agents-course-404-client-error-not-found-for-url/162747). Let’s change it to [the new implementation](https://huggingface.co/docs/inference-providers/en/guides/first-api-call).

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [August 6, 2025, 2:23am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/80 "2025-08-06T02:23:08Z")

</div>

@alfredgabal the issue you were experiencing:

> RuntimeError: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: [https://cas-server.xethub.hf.co/reconstruction/c4ac4717bebd033e12a7f0036103c7383614198445be5970f0187fa2bfc0d9c3](https://cas-server.xethub.hf.co/reconstruction/c4ac4717bebd033e12a7f0036103c7383614198445be5970f0187fa2bfc0d9c3)

Should be addressed with the most current version of `hf-xet`, just `pip install -U hf-xet`, verify that you have a version \>= `1.1.7` and you should be good to go.

---

<div class="post-metadata">

**Author:** ![muenyz](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@muenyz](https://discuss.huggingface.co/u/muenyz)\
**Post date:** [August 16, 2025, 6:12am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/81 "2025-08-16T06:12:25Z")

</div>

Hi, I also meet the error and my hf-xet’s version is 1.1.7.following is traceback.

```auto
Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/load.py", line 1412, in load_dataset
    builder_instance.download_and_prepare(
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/builder.py", line 894, in download_and_prepare
    self._download_and_prepare(
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/builder.py", line 948, in _download_and_prepare
    split_generators = self._split_generators(dl_manager, **split_generators_kwargs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/packaged_modules/parquet/parquet.py", line 49, in _split_generators
    data_files = dl_manager.download_and_extract(self.config.data_files)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/download/download_manager.py", line 326, in download_and_extract
    return self.extract(self.download(url_or_urls))
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/download/download_manager.py", line 159, in download
    downloaded_path_or_paths = map_nested(
                               ^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/utils/py_utils.py", line 504, in map_nested
    map_nested(
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/utils/py_utils.py", line 521, in map_nested
    _single_map_nested((function, obj, batched, batch_size, types, None, True, None))
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/utils/py_utils.py", line 389, in _single_map_nested
    return [mapped_item for batch in iter_batched(data_struct, batch_size) for mapped_item in function(batch)]
                                                                                              ^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/download/download_manager.py", line 220, in _download_batched
    self._download_single(url_or_filename, download_config=download_config)
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/download/download_manager.py", line 229, in _download_single
    out = cached_path(url_or_filename, download_config=download_config)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/datasets/utils/file_utils.py", line 177, in cached_path
    ).hf_hub_download(
      ^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/hf_api.py", line 5528, in hf_hub_download
    return hf_hub_download(
           ^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1010, in hf_hub_download
    return _hf_hub_download_to_cache_dir(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1171, in _hf_hub_download_to_cache_dir
    _download_to_tmp_and_move(
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 1723, in _download_to_tmp_and_move
    xet_get(
  File "/root/miniconda3/envs/mor/lib/python3.12/site-packages/huggingface_hub/file_download.py", line 629, in xet_get
    download_files(
RuntimeError: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: 

```

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [August 18, 2025, 7:18pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/82 "2025-08-18T19:18:22Z")

</div>

Hi @muenyz - thanks for the report!

At the end of the trace you provided there should have been a domain included - could you provide that for further troubleshooting?

Also if you could let me know:

- The repository where you encountered this
- What API (e.g., `snapshot_download`, or `hf download`, etc) you were using

That should help us narrow down the reasons that you ran into this. Thank you!

---

<div class="post-metadata">

**Author:** ![muenyz](https://avatars.discourse-cdn.com/v4/letter/m/ecae2f/32.png) [@muenyz](https://discuss.huggingface.co/u/muenyz)\
**Post date:** [August 23, 2025, 9:23am UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/83 "2025-08-23T09:23:58Z")

</div>

Hi,

the domain was [https://cas-server.xethub.hf.co/reconstruction/e4c425cb37d8e5464f8704c27f2956be05ad34629c3260c64603b451ced33924](https://cas-server.xethub.hf.co/reconstruction/e4c425cb37d8e5464f8704c27f2956be05ad34629c3260c64603b451ced33924)

I was trying to use load\_dataset to get a dataset,may be codelion/fineweb-edu-1B.And I finally got the dataset by disabling the technique.

---

<div class="post-metadata">

**Author:** ![jsulz](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/jsulz/32/28279_2.png) [@jsulz](https://discuss.huggingface.co/u/jsulz)\
**Post date:** [August 26, 2025, 7:35pm UTC](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714/84 "2025-08-26T19:35:57Z")

</div>

Thanks @muenyz - has this been a persistent issue? Meaning, if you attempt to issue another download request for the same resource, do you consistently run into a 401?

[Previous page](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714.md?page=3)

[Next page](https://discuss.huggingface.co/t/error-401-client-error-unauthorized-for-url/19714.md?page=5)
