astral-sh/uv · error · anyhow::Error

Failed to clear registry entries under HKCU:\{python_entry}:

Error message

Failed to clear registry entries under HKCU:\{python_entry}: {err}

What it means

Error "Failed to clear registry entries under HKCU:\{python_entry}: {err}" thrown in astral-sh/uv.

Source

Thrown at crates/uv-python/src/windows_registry.rs:254

    }

    for installation in installations {
        let python_tag = registry_python_tag(installation.key());
        let python_entry = format!("{astral_key}\\{python_tag}");
        debug!("Removing registry key HKCU:\\{}", python_entry);
        if let Err(err) = CURRENT_USER.remove_tree(&python_entry) {
            if err.code() == HRESULT::from(ERROR_FILE_NOT_FOUND)
                || err.code() == HRESULT::from(ERROR_KEY_DELETED)
            {
                debug!(
                    "No registry entries to remove for {}, no registry key {}",
                    installation.key(),
                    python_entry
                );
            } else {
                errors.push((
                    installation.key().clone(),
                    anyhow!("Failed to clear registry entries under HKCU:\\{python_entry}: {err}"),
                ));
            }
        }
    }
}

/// Remove Python entries from the Windows Registry (PEP 514) that are not matching any
/// installation.
pub fn remove_orphan_registry_entries(installations: &[ManagedPythonInstallation]) {
    let keep: HashSet<_> = installations
        .iter()
        .map(|installation| registry_python_tag(installation.key()))
        .collect();
    let astral_key = format!("Software\\Python\\{COMPANY_KEY}");
    let key = match CURRENT_USER.open(&astral_key) {
        Ok(subkeys) => subkeys,
        Err(err)
            if err.code() == HRESULT::from(ERROR_FILE_NOT_FOUND)

View on GitHub (pinned to f1a42680ff)

When it happens

Trigger: Thrown at crates/uv-python/src/windows_registry.rs:254 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of astral-sh/uv@f1a42680ff (2026-08-16). Data as JSON: /api/errors/9e621d7be496a4d7. Report an issue: GitHub.