SeleniumHQ/selenium · error · anyhow::Error

Unable to extract PKG: no Payload found

Error message

Unable to extract PKG: no Payload found

What it means

Error "Unable to extract PKG: no Payload found" thrown in SeleniumHQ/selenium.

Source

Thrown at rust/src/files.rs:290

        if chunk.len() >= XZ_MAGIC.len() && chunk[..XZ_MAGIC.len()] == XZ_MAGIC {
            XzDecoder::new(&chunk[..]).read_to_end(&mut output)?;
        } else {
            output.extend_from_slice(&chunk);
        }
    }
    Ok(output)
}

pub fn uncompress_pkg(compressed_file: &str, target: &Path, log: &Logger) -> Result<(), Error> {
    let target_path = Path::new(target);
    let mut xar = PkgReader::new(File::open(compressed_file)?)?.into_inner();

    let payload_path = xar
        .files()?
        .into_iter()
        .map(|(name, _)| name)
        .find(|name| name == "Payload" || name.ends_with("/Payload"))
        .ok_or(anyhow!("Unable to extract PKG: no Payload found"))?;
    let payload = xar
        .get_file_data_from_path(&payload_path)?
        .ok_or(anyhow!("Unable to extract PKG: empty Payload"))?;

    // Newer macOS packages (e.g. Firefox beta) wrap the cpio Payload in the pbzx
    // format, which apple-flat-package cannot decode. Unwrap pbzx to the raw cpio
    // stream; gzip and uncompressed payloads are handled by payload_reader as-is.
    let payload = if payload.len() >= PBZX_MAGIC.len() && payload[..PBZX_MAGIC.len()] == PBZX_MAGIC
    {
        log.trace("Decoding pbzx-compressed Payload".to_string());
        decode_pbzx(&payload)?
    } else {
        payload
    };

    let package = ComponentPackageReader::from_file_data(None, None, Some(payload), None)?;
    if let Some(mut cpio_reader) = package.payload_reader()? {
        while let Some(next) = cpio_reader.next() {

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Verify the downloaded .pkg file is complete and not truncated; re-download the browser installer
  2. Check that the .pkg is a valid XAR archive (run 'xar -tf file.pkg' to list entries and confirm a Payload exists)
  3. If the PKG was produced by an unsupported packaging variant, use a different browser version or install the browser manually

When it happens

Trigger: Thrown at rust/src/files.rs:290 when the library encounters an invalid state.

Common situations: Occurs when extracting a macOS PKG download and the Payload archive is missing. Prevent it by verifying the download completed successfully and the PKG file is intact (re-download if truncated or corrupted).


AI-assisted analysis of SeleniumHQ/selenium@aa36b38e69 (2026-08-14). Data as JSON: /api/errors/ede654a07c75e2f3. Report an issue: GitHub.