SeleniumHQ/selenium · error · anyhow::Error

Downloaded file cannot be uncompressed ({} extension)

Error message

Downloaded file cannot be uncompressed ({} extension)

What it means

Raised in uncompress() (files.rs:195) when `infer` successfully detects a file type but its extension is none of the supported containers (zip/gz/bz2/xz/pkg/dmg/exe/deb/msi/xml/html). Selenium Manager cannot decompress the unknown format and reports the extension.

Source

Thrown at rust/src/files.rs:195

        )?
    } else if extension.eq_ignore_ascii_case(PKG) {
        uncompress_pkg(compressed_file, target, log)?
    } else if extension.eq_ignore_ascii_case(DMG) {
        uncompress_dmg(compressed_file, target, log, volume.unwrap_or_default())?
    } else if extension.eq_ignore_ascii_case(EXE) {
        uncompress_sfx(compressed_file, target, log)?
    } else if extension.eq_ignore_ascii_case(DEB) {
        uncompress_deb(compressed_file, target, log, volume.unwrap_or_default())?
    } else if extension.eq_ignore_ascii_case(MSI) {
        install_msi(compressed_file, log, os)?
    } else if extension.eq_ignore_ascii_case(XML) || extension.eq_ignore_ascii_case(HTML) {
        log.debug(format!(
            "Wrong downloaded driver: {}",
            fs::read_to_string(compressed_file).unwrap_or_default()
        ));
        return Err(anyhow!(PARSE_ERROR));
    } else {
        return Err(anyhow!(format!(
            "Downloaded file cannot be uncompressed ({} extension)",
            extension
        )));
    }

    Ok(())
}

pub fn uncompress_sfx(compressed_file: &str, target: &Path, log: &Logger) -> Result<(), Error> {
    let zip_parent = Path::new(compressed_file).parent().unwrap();
    log.trace(format!(
        "Decompressing {} to {}",
        compressed_file,
        zip_parent.display()
    ));

    let file_bytes = read_bytes_from_file(compressed_file)?;
    let header = find_bytes(&file_bytes, SEVEN_ZIP_HEADER);

View on GitHub (pinned to aa36b38e69)

Solutions

  1. Inspect the file type with `file <path>` and confirm the extension shown in the error.
  2. Re-download to rule out a corrupted/misidentified file.
  3. If the upstream format genuinely changed, extend the if-chain in uncompress() to handle it.
  4. Verify the mirror URL serves the original archive format.
Defensive patterns

Strategy: validation

Validate before calling

# Bash: confirm the archive format is supported before extraction
SUPPORTED='zip gz bz2 xz pkg dmg exe deb msi'
EXT=${FILE##*.}
if ! echo " $SUPPORTED " | grep -iq " $EXT "; then
  echo "Unsupported archive format: $EXT"; exit 1
fi

Try / catch

match uncompress(file, target, &log, os, single, vol) {
    Ok(()) => (),
    Err(e) if e.to_string().contains("cannot be uncompressed") => {
        eprintln!("Unsupported extension {}; re-download or convert", file);
        return Err(e);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: The if-chain at lines 162-194 finds no matching extension after `infer` returned a known kind. The final else returns the error with the detected extension. Example: a .7z or .rar archive, or a .tar without compression handled differently.

Common situations: Upstream changes packaging to a new format (e.g. .zst); a mirror serves a recompressed archive; a corrupted download is misidentified by `infer`; an exotic driver ships an unsupported container.

Related errors


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