Skip to content

hf download routinely crashes with HF_HUB_DISABLE_XET (no retry) #4349

Description

@gohai

Describe the bug

XET unfortunately doesn't work on my network. Downloading with HF_HUB_DISABLE_XET=1 will randomly fail with a similar protocol error httpx.RemoteProtocolError: peer closed connection without sending complete message body (received 17281988305 bytes, expected 42520394144). When this happens, there is no automatic retry, and no files left in the cache to resume the download.

Reproduction

Unable to reproduce constantly, but this is happening ca 2/3rds of tries when downloading a 40 GB model from the hub.

Logs

", line 897, in iter_bytes
    for raw_bytes in self.iter_raw():
                     ~~~~~~~~~~~~~^^
  File "/home/gohai/.hf-cli/venv/lib64/python3.13/site-packages/httpx/_models.py", line 951, in iter_raw
    for raw_stream_bytes in self.stream:
                            ^^^^^^^^^^^
  File "/home/gohai/.hf-cli/venv/lib64/python3.13/site-packages/httpx/_client.py", line 153, in __iter__
    for chunk in self._stream:
                 ^^^^^^^^^^^^
  File "/home/gohai/.hf-cli/venv/lib64/python3.13/site-packages/httpx/_transports/default.py", line 126, in __iter__
    with map_httpcore_exceptions():
         ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/contextlib.py", line 162, in __exit__
    self.gen.throw(value)
    ~~~~~~~~~~~~~~^^^^^^^
  File "/home/gohai/.hf-cli/venv/lib64/python3.13/site-packages/httpx/_transports/default.py", line 118, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.RemoteProtocolError: peer closed connection without sending complete message body (received 17281988305 bytes, expected 42520394144)
Segmentation fault (core dumped)

System info

- huggingface_hub version: 1.18.0
- Platform: Linux-6.17.10-100.fc41.x86_64-x86_64-with-glibc2.40
- Python version: 3.13.9
- Running in iPython ?: No
- Running in notebook ?: No
- Running in Google Colab ?: No
- Running in Google Colab Enterprise ?: No
- Token path ?: /home/gohai/.cache/huggingface/token
- Has saved token ?: True
- Who am I ?: gohai
- Configured git credential helpers:
- Run by AI agent ?: No
- Installation method: hf_installer
- httpx: 0.28.1
- hf_xet: 1.5.1
- gradio: N/A
- tensorboard: N/A
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /home/gohai/.cache/huggingface/hub
- HF_ASSETS_CACHE: /home/gohai/.cache/huggingface/assets
- HF_TOKEN_PATH: /home/gohai/.cache/huggingface/token
- HF_STORED_TOKENS_PATH: /home/gohai/.cache/huggingface/stored_tokens
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS: False
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_DISABLE_XET: True
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
- HF_XET_HIGH_PERFORMANCE: False

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions