BadRequestError for loading dataset?
State: closed

### Describe the bug

Up until a couple days ago I was having no issues loading `Helsinki-NLP/europarl` and `Helsinki-NLP/un_pc`, but now suddenly I get the following error:

```
huggingface_hub.errors.BadRequestError: (Request ID: ...)

Bad request:
* Invalid input: expected array, received string * at paths * Invalid input: expected boolean, received string * at expand
✖ Invalid input: expected array, received string
  → at paths
✖ Invalid input: expected boolean, received string
  → at expand
```

I tried with both `4.0.0` and `3.5.1` since this dataset uses `trust_remote_code`, but I get the same error with both.

What can I do to load the dataset? I checked the documentation and GitHub issues here, but couldn't find a solution.

### Steps to reproduce the bug

```python
import datasets
ds = datasets.load_dataset("Helsinki-NLP/europarl", "en-fr", streaming=True, trust_remote_code=True)["train"]
```

### Expected behavior

That the dataset loads as it did a couple days ago.

### Environment info

- `datasets` version: 3.5.1
- Platform: Linux-4.18.0-513.24.1.el8_9.x86_64-x86_64-with-glibc2.28
- Python version: 3.11.11
- `huggingface_hub` version: 0.30.2
- PyArrow version: 20.0.0
- Pandas version: 2.2.2
- `fsspec` version: 2024.6.1

Comments:
Same here, for `HuggingFaceFW/fineweb`. Code that worked with no issues for the last 2 months suddenly fails today. Tried updating `datasets`, `huggingface_hub`, `fsspec` to newest versions, but the same error occurs.

I'm also hitting this issue, with `mandarjoshi/trivia_qa`; My dataset loading was working successfully yesterday - I'm using `huggingface-hub==0.27.1`, `datasets==3.2.0`

Same, here with `datasets==3.6.0`

Same, with `datasets==4.0.0`.

Same here tried different versions of huggingface-hub and datasets but the error keeps occuring 

A temporary workaround is to first download your dataset with

huggingface-cli download HuggingFaceH4/ultrachat_200k --repo-type dataset

Then find the local path of the dataset typically like ~/.cache/huggingface/hub/HuggingFaceH4-ultrachat_200k/snapshots/*id*

And then load like 

from datasets import load_dataset
dataset = load_dataset("~/.cache/huggingface/hub/HuggingFaceH4-ultrachat_200k/snapshots/*id*")


I am also experiencing this issue. I was trying to load TinyStories
ds = datasets.load_dataset("roneneldan/TinyStories", streaming=True, split="train")

resulting in the previously stated error:
Exception has occurred: BadRequestError
(Request ID: Root=1-687a1d09-66cceb496c9401b1084133d6;3550deed-c459-4799-bc74-97924742bd94)

Bad request:
* Invalid input: expected array, received string * at paths * Invalid input: expected boolean, received string * at expand
✖ Invalid input: expected array, received string
  → at paths
✖ Invalid input: expected boolean, received string
  → at expand
FileNotFoundError: Dataset roneneldan/TinyStories is not cached in None

This very code worked fine yesterday, so it's a very recent issue.

Environment info:
print("datasets version:", datasets.__version__)
print("huggingface_hub version:", huggingface_hub.__version__)
print("pyarrow version:", pyarrow.__version__)
print("pandas version:", pandas.__version__)
print("fsspec version:", fsspec.__version__)
print("Python version:", sys.version)
print("Platform:", platform.platform())
datasets version: 4.0.0
huggingface_hub version: 0.33.4
pyarrow version: 19.0.0
pandas version: 2.2.3
fsspec version: 2024.9.0
Python version: 3.12.11 (main, Jun 10 2025, 11:55:20) [GCC 15.1.1 20250425]
Platform: Linux-6.15.6-arch1-1-x86_64-with-glibc2.41

Same here with datasets==3.6.0
```
huggingface_hub.errors.BadRequestError: (Request ID: Root=1-687a238d-27374f964534f79f702bc239;61f0669c-cb70-4aff-b57b-73a446f9c65e)

Bad request:
* Invalid input: expected array, received string * at paths * Invalid input: expected boolean, received string * at expand
✖ Invalid input: expected array, received string
  → at paths
✖ Invalid input: expected boolean, received string
  → at expand
```

Same here, works perfectly yesterday

```
Error code:   ConfigNamesError
Exception:    BadRequestError
Message:      (Request ID: Root=1-687a23a5-314b45b36ce962cf0e431b9a;b979ddb2-a80b-483c-8b1e-403e24e83127)

Bad request:
* Invalid input: expected array, received string * at paths * Invalid input: expected boolean, received string * at expand
✖ Invalid input: expected array, received string
  → at paths
✖ Invalid input: expected boolean, received string
  → at expand
```

It was literally working for me and then suddenly it stopped working next time I run the command. Same issue but private repo so I can't share example. 

A bug from Hugging Face not us

Same here!

@LMSPaul thanks! The workaround seems to work (at least for the datasets I tested).

On the command line:
```sh
huggingface-cli download <dataset-name> --repo-type dataset --local-dir <local-dir>
```

And then in Python:
```python
from datasets import load_dataset

# The dataset-specific options seem to work with this as well, 
# except for a warning from "trust_remote_code"
ds = load_dataset(<local-dir>)
```

Same for me.. I couldn't load ..
It was perfectly working yesterday..


from datasets import load_dataset
raw_datasets = load_dataset("glue", "mrpc")

The error resulting is given below

---------------------------------------------------------------------------
BadRequestError                           Traceback (most recent call last)
/tmp/ipykernel_60/772458687.py in <cell line: 0>()
      1 from datasets import load_dataset
----> 2 raw_datasets = load_dataset("glue", "mrpc")

/usr/local/lib/python3.11/dist-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, keep_in_memory, save_infos, revision, token, streaming, num_proc, storage_options, trust_remote_code, **config_kwargs)
   2060 
   2061     # Create a dataset builder
-> 2062     builder_instance = load_dataset_builder(
   2063         path=path,
   2064         name=name,

/usr/local/lib/python3.11/dist-packages/datasets/load.py in load_dataset_builder(path, name, data_dir, data_files, cache_dir, features, download_config, download_mode, revision, token, storage_options, trust_remote_code, _require_default_config_name, **config_kwargs)
   1780         download_config = download_config.copy() if download_config else DownloadConfig()
   1781         download_config.storage_options.update(storage_options)
-> 1782     dataset_module = dataset_module_factory(
   1783         path,
   1784         revision=revision,

/usr/local/lib/python3.11/dist-packages/datasets/load.py in dataset_module_factory(path, revision, download_config, download_mode, dynamic_modules_path, data_dir, data_files, cache_dir, trust_remote_code, _require_default_config_name, _require_custom_configs, **download_kwargs)
   1662                             f"Couldn't find '{path}' on the Hugging Face Hub either: {type(e1).__name__}: {e1}"
   1663                         ) from None
-> 1664                 raise e1 from None
   1665     elif trust_remote_code:
   1666         raise FileNotFoundError(

/usr/local/lib/python3.11/dist-packages/datasets/load.py in dataset_module_factory(path, revision, download_config, download_mode, dynamic_modules_path, data_dir, data_files, cache_dir, trust_remote_code, _require_default_config_name, _require_custom_configs, **download_kwargs)
   1627                     download_mode=download_mode,
   1628                     use_exported_dataset_infos=use_exported_dataset_infos,
-> 1629                 ).get_module()
   1630             except GatedRepoError as e:
   1631                 message = f"Dataset '{path}' is a gated dataset on the Hub."

/usr/local/lib/python3.11/dist-packages/datasets/load.py in get_module(self)
   1017         else:
   1018             patterns = get_data_patterns(base_path, download_config=self.download_config)
-> 1019         data_files = DataFilesDict.from_patterns(
   1020             patterns,
   1021             base_path=base_path,

/usr/local/lib/python3.11/dist-packages/datasets/data_files.py in from_patterns(cls, patterns, base_path, allowed_extensions, download_config)
    687                 patterns_for_key
    688                 if isinstance(patterns_for_key, DataFilesList)
--> 689                 else DataFilesList.from_patterns(
    690                     patterns_for_key,
    691                     base_path=base_path,

/usr/local/lib/python3.11/dist-packages/datasets/data_files.py in from_patterns(cls, patterns, base_path, allowed_extensions, download_config)
    580             try:
    581                 data_files.extend(
--> 582                     resolve_pattern(
    583                         pattern,
    584                         base_path=base_path,

/usr/local/lib/python3.11/dist-packages/datasets/data_files.py in resolve_pattern(pattern, base_path, allowed_extensions, download_config)
    358     matched_paths = [
    359         filepath if filepath.startswith(protocol_prefix) else protocol_prefix + filepath
--> 360         for filepath, info in fs.glob(pattern, detail=True, **glob_kwargs).items()
    361         if (info["type"] == "file" or (info.get("islink") and os.path.isfile(os.path.realpath(filepath))))
    362         and (xbasename(filepath) not in files_to_ignore)

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_file_system.py in glob(self, path, **kwargs)
    519         kwargs = {"expand_info": kwargs.get("detail", False), **kwargs}
    520         path = self.resolve_path(path, revision=kwargs.get("revision")).unresolve()
--> 521         return super().glob(path, **kwargs)
    522 
    523     def find(

/usr/local/lib/python3.11/dist-packages/fsspec/spec.py in glob(self, path, maxdepth, **kwargs)
    635             # any exception allowed bar FileNotFoundError?
    636             return False
--> 637 
    638     def lexists(self, path, **kwargs):
    639         """If there is a file at the given path (including

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_file_system.py in find(self, path, maxdepth, withdirs, detail, refresh, revision, **kwargs)
    554         """
    555         if maxdepth:
--> 556             return super().find(
    557                 path, maxdepth=maxdepth, withdirs=withdirs, detail=detail, refresh=refresh, revision=revision, **kwargs
    558             )

/usr/local/lib/python3.11/dist-packages/fsspec/spec.py in find(self, path, maxdepth, withdirs, detail, **kwargs)
    498         # This is needed for posix glob compliance
    499         if withdirs and path != "" and self.isdir(path):
--> 500             out[path] = self.info(path)
    501 
    502         for _, dirs, files in self.walk(path, maxdepth, detail=True, **kwargs):

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_file_system.py in info(self, path, refresh, revision, **kwargs)
    717                 out = out1[0]
    718             if refresh or out is None or (expand_info and out and out["last_commit"] is None):
--> 719                 paths_info = self._api.get_paths_info(
    720                     resolved_path.repo_id,
    721                     resolved_path.path_in_repo,

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_validators.py in _inner_fn(*args, **kwargs)
    112             kwargs = smoothly_deprecate_use_auth_token(fn_name=fn.__name__, has_token=has_token, kwargs=kwargs)
    113 
--> 114         return fn(*args, **kwargs)
    115 
    116     return _inner_fn  # type: ignore

/usr/local/lib/python3.11/dist-packages/huggingface_hub/hf_api.py in get_paths_info(self, repo_id, paths, expand, revision, repo_type, token)
   3397             headers=headers,
   3398         )
-> 3399         hf_raise_for_status(response)
   3400         paths_info = response.json()
   3401         return [

/usr/local/lib/python3.11/dist-packages/huggingface_hub/utils/_http.py in hf_raise_for_status(response, endpoint_name)
    463                 f"\n\nBad request for {endpoint_name} endpoint:" if endpoint_name is not None else "\n\nBad request:"
    464             )
--> 465             raise _format(BadRequestError, message, response) from e
    466 
    467         elif response.status_code == 403:

BadRequestError: (Request ID: Root=1-687a3201-087954b9245ab59672e6068e;d5bb4dbe-03e1-4912-bcec-5964c017b920)

Bad request:
* Invalid input: expected array, received string * at paths * Invalid input: expected boolean, received string * at expand
✖ Invalid input: expected array, received string
  → at paths
✖ Invalid input: expected boolean, re

Thanks for the report!
The issue has been fixed and should now work without any code changes 😄
Sorry for the inconvenience!

Closing, please open again if needed.

Works for me. Thanks!


Yes Now it's works for me..Thanks

On Fri, 18 Jul 2025, 5:25 pm Karol Brejna, ***@***.***> wrote:

> *karol-brejna-i* left a comment (huggingface/datasets#7689)
> <https://github.com/huggingface/datasets/issues/7689#issuecomment-3089238320>
>
> Works for me. Thanks!
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/huggingface/datasets/issues/7689#issuecomment-3089238320>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AJRBXNEWBJ5UYVC2IRJM5DD3JDODZAVCNFSM6AAAAACB2FDG4GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTAOBZGIZTQMZSGA>
> .
> You are receiving this because you commented.Message ID:
> ***@***.***>
>