BigPizzaV3/CodexPlusPlus · error · anyhow::Error

GetPackagePathByFullName failed with

Error message

GetPackagePathByFullName failed with {}

What it means

package_path_by_full_name also uses the two-call pattern with GetPackagePathByFullName: a null-pointer call to get the needed path_length, then a buffered call. This bail fires when the FIRST (sizing) call returns anything other than ERROR_INSUFFICIENT_BUFFER. Notably ERROR_SUCCESS with zero-length or APPMODEL_ERROR_NO_PACKAGE here are treated as failures rather than 'not found', so the error surfaces whenever the package full name cannot be resolved to a path at all.

Solutions

  1. Treat it as a per-package failure and skip that package (the caller's with_context already labels it with the full name), then re-enumerate to pick up the new package identity
  2. Retry after the Store update/install completes since full names change on update
  3. Verify the package is still registered via GetPackagesByPackageFamily before resolving its path
  4. Check the logged Win32 code (e.g. 15700-series APPMODEL errors mean package not found)

Example fix

// before
let install_location = package_path_by_full_name(&full_name)
    .with_context(|| format!("failed to resolve registered package {full_name}"))?;
// after
let Ok(install_location) = package_path_by_full_name(&full_name) else {
    eprintln!("skipping stale package {full_name}");
    continue;
};
Defensive patterns

Strategy: fallback

Validate before calling

// check the package is still registered before resolving its path
let still_registered = package_full_names_for_family(family)?.iter().any(|n| n == &full_name);
if !still_registered { skip(); }

Try / catch

let path = match package_path_by_full_name(&full_name) {
    Ok(p) => p,
    Err(e) => { log::debug!("skipping {full_name}: {e:#}"); continue; }
};

Prevention

When it happens

Trigger: Resolving the install path of a package full name returned by GetPackagesByPackageFamily when that package was removed/re-registered between the two API calls, or when the full name is invalid/unregistered (APPMODEL_ERROR_NO_PACKAGE), or an access/arg error occurs.

Common situations: A Store update replaced the package (full names change after Codex updates, per the code comment) during enumeration; a staging-removal race; querying on a machine where the package family is not provisioned.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/f80233bba30b305d. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/app_paths.rs:226

    use std::os::windows::ffi::OsStringExt;
    use windows::Win32::Foundation::{ERROR_INSUFFICIENT_BUFFER, ERROR_SUCCESS};
    use windows::Win32::Storage::Packaging::Appx::GetPackagePathByFullName;
    use windows::core::{PCWSTR, PWSTR};

    let full_name = full_name
        .encode_utf16()
        .chain(std::iter::once(0))
        .collect::<Vec<_>>();
    let mut path_length = 0u32;
    let first = unsafe {
        GetPackagePathByFullName(
            PCWSTR(full_name.as_ptr()),
            &mut path_length,
            PWSTR(std::ptr::null_mut()),
        )
    };
    if first != ERROR_INSUFFICIENT_BUFFER {
        bail!("GetPackagePathByFullName failed with {}", first.0);
    }
    let mut path = vec![0u16; path_length as usize];
    let status = unsafe {
        GetPackagePathByFullName(
            PCWSTR(full_name.as_ptr()),
            &mut path_length,
            PWSTR(path.as_mut_ptr()),
        )
    };
    if status != ERROR_SUCCESS {
        bail!("GetPackagePathByFullName failed with {}", status.0);
    }
    let end = path
        .iter()
        .position(|value| *value == 0)
        .unwrap_or(path.len());
    Ok(PathBuf::from(OsString::from_wide(&path[..end])))
}

View on GitHub (pinned to b1ed92e5e4)