{"record":{"id":"7623112f11e38baf","repo":"tonhowtf/omniget","slug":"aria2c-binary-not-found-after-extraction","errorCode":null,"errorMessage":"aria2c binary not found after extraction","messagePattern":"aria2c binary not found after extraction","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/dependencies.rs","lineNumber":934,"sourceCode":"                .map_err(|e| anyhow!(\"Failed to read zip entry: {}\", e))?;\n\n            let name = file.name().to_string();\n            if name.ends_with(&aria2c_name_clone) {\n                let dest = bin_dir_clone.join(&aria2c_name_clone);\n                let mut buf = Vec::new();\n                std::io::Read::read_to_end(&mut file, &mut buf)?;\n                std::fs::write(&dest, &buf)?;\n                break;\n            }\n        }\n\n        Ok::<(), anyhow::Error>(())\n    })\n    .await\n    .map_err(|e| anyhow!(\"Spawn blocking failed: {}\", e))??;\n\n    if !aria2c_target.exists() {\n        return Err(anyhow!(\"aria2c binary not found after extraction\"));\n    }\n\n    Ok(aria2c_target)\n}\n\n#[cfg(test)]\nmod integrity_tests {\n    use super::integrity::*;\n\n    const VAZIO: &str = \"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\";\n\n    #[test]\n    fn sha256_de_vetor_conhecido() {\n        assert_eq!(sha256_hex(b\"\"), VAZIO);\n    }\n\n    #[test]\n    fn verify_sha256_recusa_binario_adulterado() {","sourceCodeStart":916,"sourceCodeEnd":952,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/dependencies.rs#L916-L952","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Log all zip entry names when no match is found to diagnose the layout","Make the entry match case-insensitive and/or match on file_name only (e.g. name.ends_with(\"aria2c.exe\"))","Verify the pinned URL points to the expected win-64bit build whose zip contains aria2c.exe at any depth","Fall back to searching the system PATH instead of failing hard"],"exampleFix":"// before\nlet name = file.name().to_string();\nif name.ends_with(&aria2c_name_clone) {\n// after\nlet name = file.name().to_string();\nlet matches = name\n    .rsplit('/')\n    .next()\n    .map(|f| f.eq_ignore_ascii_case(&aria2c_name_clone))\n    .unwrap_or(false);\nif matches {\ntracing::warn!(\"no aria2c entry in zip; entries: {:?}\",\n    (0..archive.len()).filter_map(|i| archive.by_index(i).ok().map(|f| f.name().to_string())).collect::<Vec<_>>());","handlingStrategy":"validation","validationCode":"// Verify the expected binary exists in the archive before extraction\nlet mut found = false;\nfor i in 0..archive.len() {\n    if let Ok(f) = archive.by_index(i) {\n        if f.name().rsplit('/').next().unwrap_or(\"\").eq_ignore_ascii_case(\"aria2c.exe\") {\n            found = true;\n            break;\n        }\n    }\n}\nif !found {\n    eprintln!(\"zip does not contain aria2c.exe; check release URL and platform build\");\n}","typeGuard":null,"tryCatchPattern":"match download_aria2c().await {\n    Ok(path) => Some(path),\n    Err(e) if e.to_string().contains(\"not found after extraction\") => {\n        eprintln!(\"wrong archive layout; falling back to system aria2c\");\n        find_tool(\"aria2c\").await;\n    }\n    Err(e) => { eprintln!(\"aria2c download failed: {}\", e); None }\n}","preventionTips":["Log zip entry names on miss so layout changes in upstream releases are visible immediately","Match entry names case-insensitively and on the file name component only","Pin an exact, verified release URL and its SHA-256 so the archive layout is known","If the target file is missing after extraction, fall back to system PATH lookup instead of failing"],"tags":["rust","zip","extraction","missing-binary"],"backgroundTag":"file-not-found","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}