From f190514288dba1e52bb3a4d45fcb4261ad6b74d0 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 13 Mar 2026 14:11:05 -0500 Subject: [PATCH] Improve error handling for platform detection in Python downloads (#18453) I noticed this weird error chain in https://github.com/astral-sh/uv/issues/8635#issuecomment-4055185865 ``` error: Failed to parse request part Caused by: Could not read ELF interpreter from any of the following paths: /bin/sh, /usr/bin/env, /bin/dash, /bin/ls ``` Co-authored-by: Claude --- crates/uv-python/src/downloads.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/uv-python/src/downloads.rs b/crates/uv-python/src/downloads.rs index 6e6e32b81..b7f88c073 100644 --- a/crates/uv-python/src/downloads.rs +++ b/crates/uv-python/src/downloads.rs @@ -405,7 +405,10 @@ impl PythonDownloadRequest { /// /// Platform information is pulled from the environment. pub fn fill_platform(mut self) -> Result { - let platform = Platform::from_env()?; + let platform = Platform::from_env().map_err(|err| match err { + platform::Error::LibcDetectionError(err) => Error::LibcDetection(err), + err => Error::InvalidRequestPlatform(err), + })?; if self.arch.is_none() { self.arch = Some(ArchRequest::Environment(platform.arch)); }