Skip to content

[CLI] No traceback on LocalEntryNotFoundError#4190

Open
Wauplin wants to merge 2 commits intomainfrom
no-traceback-on-local-entry-not-found
Open

[CLI] No traceback on LocalEntryNotFoundError#4190
Wauplin wants to merge 2 commits intomainfrom
no-traceback-on-local-entry-not-found

Conversation

@Wauplin
Copy link
Copy Markdown
Contributor

@Wauplin Wauplin commented May 5, 2026

With this PR:

$ HF_HUB_OFFLINE=1 hf download gpt2 config.json
Error: Local entry not found. Cannot reach https://huggingface.co/gpt2/resolve/main/config.json: offline mode is enabled. To disable it, please unset the `HF_HUB_OFFLINE` environment variable.
Set HF_DEBUG=1 as environment variable for full traceback.

cc @julien-c


Note

Low Risk
Low risk: changes are limited to CLI exception-to-message formatting and should not affect core download behavior. Main risk is minor messaging/regression in which exception gets matched/printed for offline/local-cache error cases.

Overview
Improves CLI error formatting for offline/local-cache download scenarios by handling LocalEntryNotFoundError explicitly and printing a concise message (preferring the underlying __cause__) instead of a traceback.

Adds OfflineModeIsEnabled to the known-exception mapping so offline-mode errors also render cleanly via format_known_exception.

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

@Wauplin Wauplin requested a review from julien-c May 5, 2026 13:13
@bot-ci-comment
Copy link
Copy Markdown

bot-ci-comment Bot commented May 5, 2026

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.

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