diff --git a/crates/uv-interpreter/src/discovery.rs b/crates/uv-interpreter/src/discovery.rs index 129b4ddca..e9516f48a 100644 --- a/crates/uv-interpreter/src/discovery.rs +++ b/crates/uv-interpreter/src/discovery.rs @@ -165,8 +165,8 @@ pub enum Error { #[error(transparent)] PyLauncher(#[from] crate::py_launcher::Error), - #[error("Interpreter discovery for `{0}` requires `{1}` but it is not selected")] - SourceNotSelected(InterpreterRequest, InterpreterSource), + #[error("Interpreter discovery for `{0}` requires `{1}` but it is not selected; the following are selected: {2}")] + SourceNotSelected(InterpreterRequest, InterpreterSource, SourceSelector), } /// Lazily iterate over all discoverable Python executables. @@ -466,6 +466,7 @@ pub fn find_interpreter( return Err(Error::SourceNotSelected( request.clone(), InterpreterSource::ProvidedPath, + sources.clone(), )); } if !path.try_exists()? { @@ -484,6 +485,7 @@ pub fn find_interpreter( return Err(Error::SourceNotSelected( request.clone(), InterpreterSource::ProvidedPath, + sources.clone(), )); } if !path.try_exists()? { @@ -508,6 +510,7 @@ pub fn find_interpreter( return Err(Error::SourceNotSelected( request.clone(), InterpreterSource::SearchPath, + sources.clone(), )); } let Some(executable) = which(name).ok() else { diff --git a/crates/uv-interpreter/src/lib.rs b/crates/uv-interpreter/src/lib.rs index f49a7531b..b8ab079d1 100644 --- a/crates/uv-interpreter/src/lib.rs +++ b/crates/uv-interpreter/src/lib.rs @@ -1421,7 +1421,11 @@ mod tests { matches!( result, Err(Error::Discovery( - crate::discovery::Error::SourceNotSelected(_, InterpreterSource::ProvidedPath) + crate::discovery::Error::SourceNotSelected( + _, + InterpreterSource::ProvidedPath, + _ + ) )) ), // TODO(zanieb): We should allow this, just enforce it's a virtualenv