Registry Mirror
Skip to content

Conversation

@NoiceHax

Copy link
Copy Markdown
Contributor

Description

xr.open_dataset(["file1.nc", "file2.nc"]) failed with "did not find a match in any of xarray's currently installed IO backends", which sends you off checking whether one of the files is corrupt or whether a dependency is missing. The real problem is that the argument is a list and the user wants open_mfdataset.

guess_engine now spots a list or tuple and says that:

ValueError: open_dataset opens a single file, but got a list.
Use open_mfdataset to open multiple files as a single dataset.

The check sits at the end of guess_engine, next to the existing FileNotFoundError check and just before the generic ValueError. Every backend still gets a chance to claim the input first, so a third party backend that does accept a sequence keeps working. Only the path that was already failing changes.

Noice = "Noice" is added to the typos allowlist in pyproject.toml so the whats-new byline passes pre-commit.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Claude Code. The code and test were drafted with it, then I read the diff and ran the tests locally.

@headtr1ck headtr1ck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@headtr1ck

Copy link
Copy Markdown
Collaborator

can you rebase/merge main? The backend tests have moved to tests/backends/test_plugings.py

NoiceHax and others added 2 commits October 9, 2026 10:11
Passing a list or tuple of paths to open_dataset failed with the
generic "did not find a match in any of xarray's currently installed
IO backends" message, which does not hint at the actual mistake.

The check sits at the end of guess_engine, right after the existing
FileNotFoundError check, so backends that do accept a sequence still
get their chance to claim the input first.
@NoiceHax

NoiceHax commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto main (d4bce83a). Thanks for the approval and for flagging the move.

The test went with the rename — git tracked xarray/tests/test_plugins.py → xarray/tests/backends/test_plugins.py, so test_guess_engine_sequence_of_paths now sits next to test_guess_engine_file_not_found where it belongs.

The only real conflict was in pyproject.toml: this branch had added Noice = "Noice" to the codespell ignore list, and main has since added Hax, Yau and whn around it. Resolved by keeping all of them — and the branch's own entry turned out to be redundant, so pyproject.toml has dropped out of the diff entirely.

Net change is now three files:

doc/whats-new.rst                     |  8 ++
xarray/backends/plugins.py            |  6 ++
xarray/tests/backends/test_plugins.py | 10 ++

pytest xarray/tests/backends/test_plugins.py → 22 passed, 1 skipped locally.

@headtr1ck headtr1ck left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thx

Comment thread doc/whats-new.rst
:py:func:`~xarray.open_mfdataset` when it is given a list or tuple of paths,
instead of reporting that no IO backend matched the input (:issue:`6510`).
By `NoiceHex <https://github.com/NoiceHax>`_.
- Fix async zarr tests using ``wraps`` with ``autospec=True`` on async methods,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad merge I assume?

@headtr1ck headtr1ck added the plan to merge Final call for comments label Oct 9, 2026
@headtr1ck
headtr1ck merged commit 2c7db29 into pydata:main Oct 12, 2026
59 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: raise more informative error message for xr.open_dataset(list_of_paths)

2 participants