From bce30be3a54896a6e75b08baa68b15499ce24b68 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 27 Aug 2025 10:48:12 -0500 Subject: [PATCH] Treat a 203 error on credential removal as a missing entry on Windows (#15552) Attempting to address the failure at https://github.com/astral-sh/uv/actions/runs/17269216842/job/49009070733?pr=15539 --- crates/uv-keyring/src/windows.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/uv-keyring/src/windows.rs b/crates/uv-keyring/src/windows.rs index 99d468d57..d86444355 100644 --- a/crates/uv-keyring/src/windows.rs +++ b/crates/uv-keyring/src/windows.rs @@ -45,8 +45,8 @@ use std::collections::HashMap; use std::iter::once; use std::str; use windows_sys::Win32::Foundation::{ - ERROR_BAD_USERNAME, ERROR_INVALID_FLAGS, ERROR_INVALID_PARAMETER, ERROR_NO_SUCH_LOGON_SESSION, - ERROR_NOT_FOUND, FILETIME, GetLastError, + ERROR_BAD_USERNAME, ERROR_ENVVAR_NOT_FOUND, ERROR_INVALID_FLAGS, ERROR_INVALID_PARAMETER, + ERROR_NO_SUCH_LOGON_SESSION, ERROR_NOT_FOUND, FILETIME, GetLastError, }; use windows_sys::Win32::Security::Credentials::{ CRED_FLAGS, CRED_MAX_CREDENTIAL_BLOB_SIZE, CRED_MAX_GENERIC_TARGET_NAME_LENGTH, @@ -500,6 +500,9 @@ pub fn decode_error() -> ErrorCode { // SAFETY: Calling Windows API match unsafe { GetLastError() } { ERROR_NOT_FOUND => ErrorCode::NoEntry, + // N.B. It's not clear why `ERROR_ENVVAR_NOT_FOUND` would be returned rather than + // `ERROR_NOT_FOUND`, but this was encountered on a Windows CI machine. + ERROR_ENVVAR_NOT_FOUND => ErrorCode::NoEntry, ERROR_NO_SUCH_LOGON_SESSION => { ErrorCode::NoStorageAccess(wrap(ERROR_NO_SUCH_LOGON_SESSION)) }