Raise FileNotFoundError for missing local files in guess_engine#11150
Merged
jsignell merged 1 commit intopydata:mainfrom Feb 10, 2026
Merged
Raise FileNotFoundError for missing local files in guess_engine#11150jsignell merged 1 commit intopydata:mainfrom
jsignell merged 1 commit intopydata:mainfrom
Conversation
…ta#10896) 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>
5 tasks
jsignell
approved these changes
Feb 10, 2026
tonybaloney
pushed a commit
to tonybaloney/swe-complex-xarray
that referenced
this pull request
Mar 19, 2026
PR: pydata#11150 Issue: pydata#10896 Base commit: dfe98a4 Changed lines: 67
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
open_datasetshould fail early, before reachingguess_enginewhen file doesn't exist #10896Summary
When
open_dataset("missing.h5")is called with a non-existent local file,guess_engine()now raises a clearFileNotFoundErrorinstead of the confusingValueError: 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 existingis_remote_uri()helper, and existing files with unrecognized extensions still produce the originalValueError.Test plan
test_guess_engine_file_not_found— verifiesFileNotFoundErrorfor string paths,PathLikeobjects, and that remote URIs still raiseValueErrortest_no_matching_engine_foundandtest_engines_not_installedto account for the new behavior