From 3e80b1027246dd22a7d1edd37150e369d8507020 Mon Sep 17 00:00:00 2001 From: konsti Date: Fri, 12 Dec 2025 18:02:49 +0100 Subject: [PATCH] Avoid panics due to reads on failed requests (#17098) Fixes https://github.com/astral-sh/uv/issues/17090, specifically the panic, not the upstream bug. --- crates/uv/src/commands/reporters.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/uv/src/commands/reporters.rs b/crates/uv/src/commands/reporters.rs index cf4ac89b1..6ad15010a 100644 --- a/crates/uv/src/commands/reporters.rs +++ b/crates/uv/src/commands/reporters.rs @@ -297,7 +297,13 @@ impl ProgressReporter { return; }; - state.lock().unwrap().bars[&id].inc(bytes); + // Avoid panics due to reads on failed requests. + // https://github.com/astral-sh/uv/issues/17090 + // TODO(konsti): Add a debug assert once https://github.com/seanmonstar/reqwest/issues/2884 + // is fixed + if let Some(bar) = state.lock().unwrap().bars.get(&id) { + bar.inc(bytes); + } } fn on_request_complete(&self, direction: Direction, id: usize) {