{"record":{"id":"9e621d7be496a4d7","repo":"astral-sh/uv","slug":"failed-to-clear-registry-entries-under-hkcu-pyth","errorCode":null,"errorMessage":"Failed to clear registry entries under HKCU:\\{python_entry}: {err}","messagePattern":"Failed to clear registry entries under HKCU:\\\\(.+?): (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/uv-python/src/windows_registry.rs","lineNumber":254,"sourceCode":"    }\n\n    for installation in installations {\n        let python_tag = registry_python_tag(installation.key());\n        let python_entry = format!(\"{astral_key}\\\\{python_tag}\");\n        debug!(\"Removing registry key HKCU:\\\\{}\", python_entry);\n        if let Err(err) = CURRENT_USER.remove_tree(&python_entry) {\n            if err.code() == HRESULT::from(ERROR_FILE_NOT_FOUND)\n                || err.code() == HRESULT::from(ERROR_KEY_DELETED)\n            {\n                debug!(\n                    \"No registry entries to remove for {}, no registry key {}\",\n                    installation.key(),\n                    python_entry\n                );\n            } else {\n                errors.push((\n                    installation.key().clone(),\n                    anyhow!(\"Failed to clear registry entries under HKCU:\\\\{python_entry}: {err}\"),\n                ));\n            }\n        }\n    }\n}\n\n/// Remove Python entries from the Windows Registry (PEP 514) that are not matching any\n/// installation.\npub fn remove_orphan_registry_entries(installations: &[ManagedPythonInstallation]) {\n    let keep: HashSet<_> = installations\n        .iter()\n        .map(|installation| registry_python_tag(installation.key()))\n        .collect();\n    let astral_key = format!(\"Software\\\\Python\\\\{COMPANY_KEY}\");\n    let key = match CURRENT_USER.open(&astral_key) {\n        Ok(subkeys) => subkeys,\n        Err(err)\n            if err.code() == HRESULT::from(ERROR_FILE_NOT_FOUND)","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/astral-sh/uv/blob/f1a42680ff5272232d65748acf338b19778dde24/crates/uv-python/src/windows_registry.rs#L236-L272","documentation":"Error \"Failed to clear registry entries under HKCU:\\{python_entry}: {err}\" thrown in astral-sh/uv.","triggerScenarios":"Thrown at crates/uv-python/src/windows_registry.rs:254 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f1a42680ff5272232d65748acf338b19778dde24","analyzedAt":"2026-08-16T04:51:47.599Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}