# Connection Error when Accessing Dataset URL on Hugging Face

**URL:** <https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418>\
**Category:** 🤗Datasets\
**Created:** [December 29, 2023, 7:22pm UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418 "2023-12-29T19:22:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mustafa21](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mustafa21/32/36429_2.png) [@Mustafa21](https://discuss.huggingface.co/u/Mustafa21)\
**Post date:** [December 29, 2023, 7:22pm UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/1 "2023-12-29T19:22:09Z")

</div>

I am currently experiencing an issue while trying to access my private dataset in my repo  
for example: ([https://huggingface.co/dataset/Mustafa21/dataset](https://huggingface.co/dataset/Mustafa21/dataset))

The error message I encountered is as follows:

```python
ionError(f"Couldn't reach {url} ({repr(head_error)})")
ConnectionError: Couldn't reach https://huggingface.co/datasets/Mustafa21/dataset/resolve/main/dataset_infos.json (ConnectionError('Unauthorized for URL https://huggingface.co/datasets/Mustafa21/dataset/resolve/main/dataset_infos.json. Please use the parameter `use_auth_token=True` after logging in with `huggingface-cli login`'))

```

Thank you in advance for your help!

---

<div class="post-metadata">

**Author:** ![mariosasko](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mariosasko/32/31548_2.png) [@mariosasko](https://discuss.huggingface.co/u/mariosasko)\
**Post date:** [January 15, 2024, 7:26pm UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/2 "2024-01-15T19:26:57Z")

</div>

You must log in as explained [here](https://huggingface.co/docs/huggingface_hub/quick-start#authentication) and then pass `use_auth_token=True` to avoid this error.

PS: Newer `datasets` versions automatically read the token if it’s available in the environment, so the last step is optional.

---

<div class="post-metadata">

**Author:** ![brodao](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/brodao/32/23192_2.png) [@brodao](https://discuss.huggingface.co/u/brodao)\
**Post date:** [January 26, 2024, 3:26am UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/3 "2024-01-26T03:26:10Z")

</div>

same problem, even after logging in as indicated  
the HF\_TOKEN environment variable is set too (I try without set)

```auto
 A token is already saved on your machine. Run `huggingface-cli whoami` to get more information or `huggingface-cli logout` if you want to log out.
    Setting a new token will erase the existing one.
    To login, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens .
Token can be pasted using 'Right-Click'.
Token:
Add token as git credential? (Y/n)
Token is valid (permission: write).
Your token has been saved in your configured git credential helpers (manager).
Your token has been saved to C:\Users\XXXXXXXX\.cache\huggingface\token
Login successful

(.venv) P:\ia>datasets-cli test dd_tables/dd_tables.py --save_info --all_configs                      
p:\ia\.venv\lib\site-packages\datasets\load.py:922: FutureWarning: The repository for dd_tables contains custom code which must be executed to correctly load the dataset. You can inspect the repository content at dd_tables/dd_tables.py
You can avoid this message in future by passing the argument `trust_remote_code=True`.
Passing `trust_remote_code=True` will be mandatory to load this dataset from the next major release of `datasets`.
  warnings.warn(
Loading Dataset Infos from C:\Users\broda\.cache\huggingface\modules\datasets_modules\datasets\dd_tables\0fad2ad8ca44d9919f0b749ed4322b6979f99bdfe7f31313738bd67ad699364c
Testing builder 'default' (1/1)
Generating dataset dd_tables (C:/Users/broda/.cache/huggingface/datasets/dd_tables/default/1.0.0)
Downloading and preparing dataset dd_tables/default to C:/Users/broda/.cache/huggingface/datasets/dd_tables/default/1.0.0...
Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python39_64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "p:\ia\.venv\Scripts\datasets-cli.exe\ __main__.py", line 7, in <module>
  File "p:\ia\.venv\lib\site-packages\datasets\commands\datasets_cli.py", line 39, in main
    service.run()
  File "p:\ia\.venv\lib\site-packages\datasets\commands\test.py", line 146, in run
    builder.download_and_prepare(
  File "p:\ia\.venv\lib\site-packages\datasets\builder.py", line 1005, in download_and_prepare
    self._download_and_prepare(
  File "p:\ia\.venv\lib\site-packages\datasets\builder.py", line 1767, in _download_and_prepare
    super()._download_and_prepare(
  File "p:\ia\.venv\lib\site-packages\datasets\builder.py", line 1078, in _download_and_prepare
    split_generators = self._split_generators(dl_manager, **split_generators_kwargs)
  File "C:\Users\broda\.cache\huggingface\modules\datasets_modules\datasets\dd_tables\0fad2ad8ca44d9919f0b749ed4322b6979f99bdfe7f31313738bd67ad699364c\dd_tables.py", line 57, in _split_generators
    archive = dl_manager.download(_DOWNLOAD_URL)
  File "p:\ia\.venv\lib\site-packages\datasets\download\download_manager.py", line 426, in download
    downloaded_path_or_paths = map_nested(
  File "p:\ia\.venv\lib\site-packages\datasets\utils\py_utils.py", line 459, in map_nested
    return function(data_struct)
  File "p:\ia\.venv\lib\site-packages\datasets\download\download_manager.py", line 451, in _download
    out = cached_path(url_or_filename, download_config=download_config)
  File "p:\ia\.venv\lib\site-packages\datasets\utils\file_utils.py", line 188, in cached_path
    output_path = get_from_cache(
  File "p:\ia\.venv\lib\site-packages\datasets\utils\file_utils.py", line 573, in get_from_cache
    raise ConnectionError(f"Couldn't reach {url} ({repr(head_error)})")
ConnectionError: Couldn't reach https://huggingface.co/datasets/brodao/dd_tables (ConnectionError('Unauthorized for URL https://huggingface.co/datasets/brodao/dd_tables. Please use the parameter `token=True` after logging in with `huggingface-cli login`'))

```

---

<div class="post-metadata">

**Author:** ![Mustafa21](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mustafa21/32/36429_2.png) [@Mustafa21](https://discuss.huggingface.co/u/Mustafa21)\
**Post date:** [February 1, 2024, 11:16pm UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/4 "2024-02-01T23:16:41Z")

</div>

I still have the issue

---

<div class="post-metadata">

**Author:** ![Mustafa21](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/mustafa21/32/36429_2.png) [@Mustafa21](https://discuss.huggingface.co/u/Mustafa21)\
**Post date:** [February 2, 2024, 11:27am UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/5 "2024-02-02T11:27:52Z")

</div>

I have changed the Token key and it worked

---

<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:** [February 2, 2024, 11:28pm UTC](https://discuss.huggingface.co/t/connection-error-when-accessing-dataset-url-on-hugging-face/67418/6 "2024-02-02T23:28:14Z")

</div>

Closed on February 2, 2024, 11:28pm UTC

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