Skip to content
Latchkey

Hugging Face datasets "FileNotFoundError: Couldn't find a dataset script" in CI

load_dataset could not locate the dataset locally or on the Hub. The name is wrong or unqualified, a local path does not exist, or a private dataset was requested without a token so the Hub hides it.

What this error means

load_dataset fails with "FileNotFoundError: Couldn't find a dataset script at <path> or any data file in the directory" on the runner.

datasets
FileNotFoundError: Couldn't find a dataset script at /home/runner/work/app/my_dataset/my_dataset.py
or any data file in the directory. Couldn't find 'my_dataset' on the Hugging Face Hub either.

Common causes

The dataset id or local path is wrong

A typo, a missing org/ prefix, or a path that does not exist on the runner means datasets finds nothing to load.

A private dataset requested without a token

Without HF_TOKEN, the Hub hides the private dataset, so it appears missing.

How to fix it

Use the exact dataset id and set a token if private

  1. Copy the dataset id from its Hub page (including the org).
  2. For a local dataset, confirm the path exists in the checkout.
  3. Set HF_TOKEN in the job for a private dataset.
.github/workflows/ci.yml
env:
  HF_TOKEN: ${{ secrets.HF_TOKEN }}

Load with the correct config name

Some datasets require a config; pass it explicitly so datasets resolves the right files.

python
from datasets import load_dataset
load_dataset("glue", "mrpc")

How to prevent it

  • Copy dataset ids and config names from the Hub page.
  • Set HF_TOKEN for private datasets in CI.
  • Verify local dataset paths exist after checkout.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →