Registry Mirror
Skip to content

Conversation

@kkollsga

@kkollsga kkollsga commented Feb 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When open_dataset("missing.h5") is called with a non-existent local file, guess_engine() now raises a clear FileNotFoundError instead of the confusing ValueError: did not find a match in any of xarray's currently installed IO backends.

The check runs only in the error path of guess_engine() (after all backends have already failed to match), so it has zero impact on the happy path. Remote URIs are excluded using the existing is_remote_uri() helper, and existing files with unrecognized extensions still produce the original ValueError.

Test plan

  • test_guess_engine_file_not_found — verifies FileNotFoundError for string paths, PathLike objects, and that remote URIs still raise ValueError
  • Updated test_no_matching_engine_found and test_engines_not_installed to account for the new behavior
  • Pre-commit (ruff, formatting) passes
  • Mypy — no new errors introduced

When `open_dataset` is called with a non-existent local file path,
`guess_engine` now raises `FileNotFoundError` instead of a confusing
"no backend found" `ValueError`. Remote URIs are not affected.

Co-Authored-By: Claude <noreply@anthropic.com>

@jsignell jsignell left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks great @kkollsga!

@jsignell
jsignell merged commit 160a85c into pydata:main Feb 10, 2026
@kkollsga
kkollsga deleted the fix-10896-missing-file-error branch February 10, 2026 22:03
tonybaloney pushed a commit to tonybaloney/swe-complex-xarray that referenced this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

open_dataset should fail early, before reaching guess_engine when file doesn't exist

2 participants