From 5ee728b3e3366a358e6708bf65edaacfc1434721 Mon Sep 17 00:00:00 2001 From: konsti Date: Thu, 9 Oct 2025 15:53:14 +0200 Subject: [PATCH] Retry all h2 errors (#16038) The h2 errors, a specific type nested in reqwest errors, all look like they shouldn't happen in regular operations and should be retried. This covers all `io::Error`s going through h2 (i.e., only HTTP 2 connections). Fixes https://github.com/astral-sh/uv/issues/15916 --- crates/uv-client/src/base_client.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/uv-client/src/base_client.rs b/crates/uv-client/src/base_client.rs index f1c5a04c6..66b28027c 100644 --- a/crates/uv-client/src/base_client.rs +++ b/crates/uv-client/src/base_client.rs @@ -1029,12 +1029,12 @@ pub fn is_transient_network_error(err: &(dyn Error + 'static)) -> bool { } trace!("Cannot retry nested reqwest error"); - } else if let Some(io_err) = source.downcast_ref::().or_else(|| { - // h2 may hide an IO error inside. - source - .downcast_ref::() - .and_then(|err| err.get_io()) - }) { + } else if source.downcast_ref::().is_some() { + // All h2 errors look like errors that should be retried + // https://github.com/astral-sh/uv/issues/15916 + trace!("Retrying nested h2 error"); + return true; + } else if let Some(io_err) = source.downcast_ref::() { has_known_error = true; let retryable_io_err_kinds = [ // https://github.com/astral-sh/uv/issues/12054