Skip to content

Expose snapshot_path on IncompleteSnapshotError - #4500

Merged
Wauplin merged 4 commits into
mainfrom
moonbot/slack-incomplete-snapshot-path-1783445506
Jul 9, 2026
Merged

Expose snapshot_path on IncompleteSnapshotError#4500
Wauplin merged 4 commits into
mainfrom
moonbot/slack-incomplete-snapshot-path-1783445506

Conversation

@moon-bot-app

@moon-bot-app moon-bot-app Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Should help huggingface/diffusers#14118 (see huggingface/diffusers#14118 (comment))

IncompleteSnapshotError now carries a snapshot_path attribute pointing to the (incomplete) local snapshot, so downstream libraries can still locate the latest cached files even when they are known to be incomplete. snapshot_download populates it at the raise site, the CLI appends the path to its error output when available, and the cache-management docs mention the attribute.

CLI example:

✗ HF_HUB_OFFLINE=1 hf download openai-community/gpt2
Error: Local entry not found. Cannot reach https://huggingface.co/api/models/openai-community/gpt2/revision/main: offline mode is enabled. To disable it, please unset the `HF_HUB_OFFLINE` environment variable.
Incomplete snapshot available at: /home/wauplin/.cache/huggingface/hub/models--openai-community--gpt2/snapshots/607a30d783dfa663caf39e06633721c8d4cfcd7e
Hint: set HF_DEBUG=1 as environment variable for full traceback.

and in Python:

try:
    snapshot_path = snapshot_download(...)
except IncompleteSnapshotError as error:
    incomplete_snapshot_path = error.snapshot_path

Requested by @Wauplin - Slack thread - Agent trace


Note

Low Risk
Small, backward-compatible extension to an existing error type with a single internal raise site updated; no auth or download logic changes.

Overview
IncompleteSnapshotError now includes a snapshot_path attribute so callers can find partially cached files when offline or local_files_only blocks completing a download.

snapshot_download sets snapshot_path to the incomplete snapshot directory (base_dir) when raising from _raise_if_incomplete_snapshot. The hf CLI registers a dedicated formatter that appends that path to the error message (before the generic LocalEntryNotFoundError handler). Cache docs note the new attribute.

Reviewed by Cursor Bugbot for commit 4a48a1f. Bugbot is set up for automated code reviews on this repo. Configure here.

Requested by @Wauplin (Lucain Pouget) via Moon Bot.
Co-authored-by: Wauplin <Wauplin@users.noreply.github.com>
Slack thread: https://huggingface.slack.com/archives/D0AHN75EA81/p1783445397440309?thread_ts=1783445397.440309&cid=D0AHN75EA81
@bot-ci-comment

bot-ci-comment Bot commented Jul 7, 2026

Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@Wauplin
Wauplin requested a review from hanouticelina July 7, 2026 18:50
@Wauplin
Wauplin marked this pull request as ready for review July 9, 2026 10:08
@Wauplin
Wauplin merged commit 7625ea3 into main Jul 9, 2026
25 of 26 checks passed
@Wauplin
Wauplin deleted the moonbot/slack-incomplete-snapshot-path-1783445506 branch July 9, 2026 10:08
@huggingface-hub-bot

Copy link
Copy Markdown
Contributor

This PR has been shipped as part of the v1.23.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant