pkgxdev/pkgx · error · io::Error (NotFound)

No inventory for

Error message

No inventory for {}

What it means

`inventory::ls` fetches a package's available versions from the upstream inventory (dist server), parses each line into a Version, and requires at least one valid entry. If the response is empty or yields no parseable versions, it raises `No inventory for {project}`. This is `select`'s dependency: without an inventory the library cannot resolve any version requirement for that project.

Solutions

  1. Verify the project name is correct and exists in the pantry (check spelling/fully-qualified name like `openssl.org`, not `openssl`)
  2. Check network access and the PKGX_DIST_URL value — hit the same URL manually to confirm an inventory is served
  3. Update pkgx/pantry data so the project's inventory is known, or pick a project version that is published
  4. If you run a mirror, ensure it proxies the inventory route for the requested project

Example fix

// before
pkgx ls openssl  // No inventory for openssl
// after
pkgx ls openssl.org
Defensive patterns

Strategy: try-catch

Validate before calling

async fn inventory_exists(project: &str, dist_url: &str) -> bool {
    // cheap pre-check: ask the inventory endpoint directly
    let url = format!("{}/{}.txt", dist_url.trim_end_matches('/'), project);
    reqwest::get(&url).await
        .map(|r| r.status().is_success() && !r.text().await.unwrap_or_default().trim().is_empty())
        .unwrap_or(false)
}

Try / catch

match select(&project, &constraint, &config).await {
    Err(e) if e.to_string().starts_with("No inventory for") => {
        eprintln!("{} has no published inventory; check name (e.g. openssl.org) or dist URL", project);
    }
    Err(e) => return Err(e),
    Ok(v) => Ok(v),
}

Prevention

When it happens

Trigger: Calling `select()` (or anything that resolves a version, e.g. `ls` for a package) where the inventory HTTP response is empty, all lines fail `Version::parse`, or the project has no entry on the dist server.

Common situations: Requesting a nonexistent or misspelled project name, an offline/behind-a-mirror dist endpoint (PKGX_DIST_URL pointing somewhere without that project's inventory), a brand-new package not yet published to the pantry dist, or a server returning an error page/empty body instead of version lines.

Related errors


AI-assisted analysis of pkgxdev/pkgx@6de1d7e953 (2026-09-10). Data as JSON: /api/errors/12be166c33c5676d. Report an issue: GitHub.

Appendix: source

Thrown at crates/lib/src/inventory.rs:43

        "{}/{}/{}/{}/versions.txt",
        base_url, project, platform, arch
    ))?;

    let rsp = build_client()?
        .get(url.clone())
        .send()
        .await?
        .error_for_status()?;

    let releases = rsp.text().await?;
    let mut versions: Vec<Version> = releases
        .lines()
        .map(Version::parse)
        .filter_map(Result::ok)
        .collect();

    if versions.is_empty() {
        return Err(Box::new(std::io::Error::new(
            std::io::ErrorKind::NotFound,
            format!("No inventory for {}", project),
        )));
    }

    if project == "openssl.org" {
        // Workaround: Remove specific version
        let excluded_version = Version::parse("1.1.118")?;
        versions.retain(|x| x != &excluded_version);
    }

    Ok(versions)
}

//TODO xz bottles are preferred
pub fn get_url(pkg: &Package, config: &Config) -> String {
    let (platform, arch) = host();
    format!(

View on GitHub (pinned to 6de1d7e953)