{"record":{"id":"f80233bba30b305d","repo":"BigPizzaV3/CodexPlusPlus","slug":"getpackagepathbyfullname-failed-with","errorCode":null,"errorMessage":"GetPackagePathByFullName failed with {}","messagePattern":"GetPackagePathByFullName failed with (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/app_paths.rs","lineNumber":206,"sourceCode":"    use std::os::windows::ffi::OsStringExt;\n    use windows::Win32::Foundation::{ERROR_INSUFFICIENT_BUFFER, ERROR_SUCCESS};\n    use windows::Win32::Storage::Packaging::Appx::GetPackagePathByFullName;\n    use windows::core::{PCWSTR, PWSTR};\n\n    let full_name = full_name\n        .encode_utf16()\n        .chain(std::iter::once(0))\n        .collect::<Vec<_>>();\n    let mut path_length = 0u32;\n    let first = unsafe {\n        GetPackagePathByFullName(\n            PCWSTR(full_name.as_ptr()),\n            &mut path_length,\n            PWSTR(std::ptr::null_mut()),\n        )\n    };\n    if first != ERROR_INSUFFICIENT_BUFFER {\n        bail!(\"GetPackagePathByFullName failed with {}\", first.0);\n    }\n    let mut path = vec![0u16; path_length as usize];\n    let status = unsafe {\n        GetPackagePathByFullName(\n            PCWSTR(full_name.as_ptr()),\n            &mut path_length,\n            PWSTR(path.as_mut_ptr()),\n        )\n    };\n    if status != ERROR_SUCCESS {\n        bail!(\"GetPackagePathByFullName failed with {}\", status.0);\n    }\n    let end = path\n        .iter()\n        .position(|value| *value == 0)\n        .unwrap_or(path.len());\n    Ok(PathBuf::from(OsString::from_wide(&path[..end])))\n}","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4/crates/codex-plus-core/src/app_paths.rs#L188-L224","documentation":"package_path_by_full_name resolves an MSIX install path via GetPackagePathByFullName with the same two-call sizing pattern. The first call must return ERROR_INSUFFICIENT_BUFFER; the most common other status is ERROR_NOT_FOUND, meaning no installed package matches the given full name - typically a stale versioned name like App_1.2.3.0_x64__hash after an update.","triggerScenarios":"Passing a package full name captured earlier that no longer matches because an app update changed the version component; a typo'd full name; the package being unregistered for the current user (per-user vs per-machine installs).","commonSituations":"A cached full name from a previous session reused after the app updated; enumeration and path lookup separated in time; package removed between sessions.","solutions":["Re-enumerate with GetPackagesByPackageFamily to obtain current full names instead of reusing a cached one","Confirm the exact full name via Get-AppxPackage in PowerShell","Reinstall the package if Get-AppxPackage shows nothing registered"],"exampleFix":"// before - reusing a stale full name captured before an app update\nlet path = package_path_by_full_name(&cached_full_name)?;\n\n// after - refresh full names from the family, then resolve\nlet full_names = package_full_names_by_family(&family)?;\nlet path = full_names.iter()\n    .find(|n| n.starts_with(app_name))\n    .and_then(|n| package_path_by_full_name(n).ok())\n    .ok_or_else(|| anyhow::anyhow!(\"no installed package matches family {family}\"))?;","handlingStrategy":"fallback","validationCode":"// Confirm registration before resolving the path\nlet installed = package_full_names_by_family(&family)?.iter().any(|n| n == &full_name);\nanyhow::ensure!(installed, \"package {full_name} is not registered for this user\");\nlet path = package_path_by_full_name(&full_name)?;","typeGuard":null,"tryCatchPattern":"let path = match package_path_by_full_name(&full_name) {\n    Ok(p) => p,\n    Err(_) => windows_app_package_roots().into_iter()\n        .map(|root| root.join(\"WindowsApps\"))\n        .find(|p| p.exists())\n        .ok_or_else(|| anyhow::anyhow!(\"no package path and no WindowsApps fallback\"))?,\n};","preventionTips":["Never cache package full names across app updates - cache the family name and re-resolve","Treat ERROR_NOT_FOUND as 'not installed' and degrade to unpackaged path discovery","Re-resolve paths whenever the target app process restarts"],"tags":["windows","msix","package-not-found","win32"],"backgroundTag":"package-not-found","analyzedSha":"fb3ebd9a82383aedd8d098aa9ae3aef9426d13a4","analyzedAt":"2026-08-17T11:35:12.031Z","contentChangedAt":"2026-08-17T11:35:12.031Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}