{"record":{"id":"1de640b985f2e1c5","repo":"SeleniumHQ/selenium","slug":"format-for-file-cannot-be-inferred","errorCode":null,"errorMessage":"Format for file {} cannot be inferred","messagePattern":"Format for file (.+?) cannot be inferred","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"rust/src/files.rs","lineNumber":143,"sourceCode":"pub fn uncompress(\n    compressed_file: &str,\n    target: &Path,\n    log: &Logger,\n    os: &str,\n    single_file: Option<String>,\n    volume: Option<&str>,\n) -> Result<(), Error> {\n    let mut extension = match infer::get_from_path(compressed_file)? {\n        Some(kind) => kind.extension(),\n        _ => {\n            if compressed_file.ends_with(PKG) || compressed_file.ends_with(DMG) {\n                if MACOS.is(os) {\n                    PKG\n                } else {\n                    return Err(anyhow!(format_one_arg(UNCOMPRESS_MACOS_ERR_MSG, PKG)));\n                }\n            } else {\n                return Err(anyhow!(format!(\n                    \"Format for file {} cannot be inferred\",\n                    compressed_file\n                )));\n            }\n        }\n    };\n    if compressed_file.ends_with(DMG) {\n        if MACOS.is(os) {\n            extension = DMG;\n        } else {\n            return Err(anyhow!(format_one_arg(UNCOMPRESS_MACOS_ERR_MSG, DMG)));\n        }\n    }\n    log.trace(format!(\n        \"The detected extension of the compressed file is {}\",\n        extension\n    ));\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rust/src/files.rs#L125-L161","documentation":"Raised in uncompress() (files.rs:143) when the `infer` crate cannot determine the file type from its bytes AND the filename does not end with .pkg or .dmg. Selenium Manager has no fallback to identify the format and aborts. The filename is included in the message.","triggerScenarios":"infer::get_from_path returns None and the filename extension is neither PKG nor DMG. The else branch at line 142 returns the error. Typical when the downloaded file is empty, a truncated download, or an unsupported format.","commonSituations":"A partial/empty download (network drop produced 0 bytes); the server returned an HTML error page saved with a driver filename; an unsupported container (e.g. zstd, rar); filesystem gave 0 bytes.","solutions":["Re-download the file; partial downloads are the most common cause.","Inspect the file with `file <path>` and check its size is non-zero.","Verify the download URL points to a real archive endpoint, not an error page.","If the format is genuinely unsupported, convert it upstream to zip/tar.gz."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# Bash: verify the downloaded file is non-empty and a known archive before extraction\nif [ ! -s \"$FILE\" ]; then echo \"Empty/truncated download\"; exit 1; fi\nfile \"$FILE\"","typeGuard":null,"tryCatchPattern":"match uncompress(file, target, &log, os, single, vol) {\n    Ok(()) => (),\n    Err(e) if e.to_string().contains(\"cannot be inferred\") => {\n        eprintln!(\"Re-download {}; possibly truncated\", file);\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check downloaded file size is non-zero before extraction.","Verify download URLs point to real archive endpoints.","Re-download on partial/corrupt files."],"tags":["rust","selenium-manager","archive","download","file-format"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}