tonhowtf/omniget · error

aria2c binary not found after extraction

Error message

aria2c binary not found after extraction

What it means

Post-extraction invariant check in download_aria2c: after iterating the zip entries, the expected aria2c binary (e.g. aria2c.exe) was not written to the managed bin directory. Either no entry name ended with the expected binary name, or the write failed silently in a way that left no file.

Solutions

  1. Log all zip entry names when no match is found to diagnose the layout
  2. Make the entry match case-insensitive and/or match on file_name only (e.g. name.ends_with("aria2c.exe"))
  3. Verify the pinned URL points to the expected win-64bit build whose zip contains aria2c.exe at any depth
  4. Fall back to searching the system PATH instead of failing hard

Example fix

// before
let name = file.name().to_string();
if name.ends_with(&aria2c_name_clone) {
// after
let name = file.name().to_string();
let matches = name
    .rsplit('/')
    .next()
    .map(|f| f.eq_ignore_ascii_case(&aria2c_name_clone))
    .unwrap_or(false);
if matches {
tracing::warn!("no aria2c entry in zip; entries: {:?}",
    (0..archive.len()).filter_map(|i| archive.by_index(i).ok().map(|f| f.name().to_string())).collect::<Vec<_>>());
Defensive patterns

Strategy: validation

Validate before calling

// Verify the expected binary exists in the archive before extraction
let mut found = false;
for i in 0..archive.len() {
    if let Ok(f) = archive.by_index(i) {
        if f.name().rsplit('/').next().unwrap_or("").eq_ignore_ascii_case("aria2c.exe") {
            found = true;
            break;
        }
    }
}
if !found {
    eprintln!("zip does not contain aria2c.exe; check release URL and platform build");
}

Try / catch

match download_aria2c().await {
    Ok(path) => Some(path),
    Err(e) if e.to_string().contains("not found after extraction") => {
        eprintln!("wrong archive layout; falling back to system aria2c");
        find_tool("aria2c").await;
    }
    Err(e) => { eprintln!("aria2c download failed: {}", e); None }
}

Prevention

When it happens

Trigger: The zip's entry names don't end with the expected aria2c name (bin_name("aria2c")) — e.g. release layout changed, nested folder name mismatch, or wrong-platform zip; or the inner extraction loop matched nothing and completed Ok without writing any file.

Common situations: aria2 upstream changed the folder/file layout in a newer release while the pinned URL was updated; case-sensitivity in name.ends_with matching; a 32-bit vs 64-bit build zip with different entry names; download of a different asset than expected.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/7623112f11e38baf. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/dependencies.rs:934

                .map_err(|e| anyhow!("Failed to read zip entry: {}", e))?;

            let name = file.name().to_string();
            if name.ends_with(&aria2c_name_clone) {
                let dest = bin_dir_clone.join(&aria2c_name_clone);
                let mut buf = Vec::new();
                std::io::Read::read_to_end(&mut file, &mut buf)?;
                std::fs::write(&dest, &buf)?;
                break;
            }
        }

        Ok::<(), anyhow::Error>(())
    })
    .await
    .map_err(|e| anyhow!("Spawn blocking failed: {}", e))??;

    if !aria2c_target.exists() {
        return Err(anyhow!("aria2c binary not found after extraction"));
    }

    Ok(aria2c_target)
}

#[cfg(test)]
mod integrity_tests {
    use super::integrity::*;

    const VAZIO: &str = "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";

    #[test]
    fn sha256_de_vetor_conhecido() {
        assert_eq!(sha256_hex(b""), VAZIO);
    }

    #[test]
    fn verify_sha256_recusa_binario_adulterado() {

View on GitHub (pinned to 8600b91f42)