Skip to content

Unclear Error Message for GatedRepoError When --hf-token is Provided #1831

@DawiAlotaibi

Description

@DawiAlotaibi

Description

The error message for GatedRepoError asks the user to provide the --hf-token, even when the token is already passed via the command-line option. This is confusing for users who have already provided the token.

Expected Behavior:

If the --hf-token argument is passed, the error message should not request it again and should focus on other potential issues (e.g., access rights or incorrect token).

Current Behavior:

The error message currently states:

"Please ensure you have access to the repository and have provided the proper Hugging Face API token using the option --hf-token or by running huggingface-cli login. You can find your token by visiting https://huggingface.co/settings/tokens"
This should not appear if the --hf-token has already been provided.

Steps to Reproduce:

  1. Pass a valid --hf-token when running the command.
  2. Encounter the GatedRepoError.
  3. Observe the message requesting the token, despite it being passed.
    image

Suggested Fix:

The error message should only suggest providing the token if it wasn’t passed through the command-line argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions