{"record":{"id":"2abd7ef43a8f9b63","repo":"tonhowtf/omniget","slug":"tar-gz-invalido-github","errorCode":null,"errorMessage":"tar.gz invalido: {}","messagePattern":"tar\\.gz invalido: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/github.rs","lineNumber":141,"sourceCode":"            let out = dest.join(rel);\n            if file.is_dir() {\n                std::fs::create_dir_all(&out)?;\n                continue;\n            }\n            if let Some(parent) = out.parent() {\n                std::fs::create_dir_all(parent)?;\n            }\n            let mut w = std::fs::File::create(&out)?;\n            std::io::copy(&mut file, &mut w)?;\n        }\n        Ok(())\n    } else if name.ends_with(\".tar.gz\") || name.ends_with(\".tgz\") {\n        let decoder = flate2::read::GzDecoder::new(std::io::Cursor::new(data));\n        let mut archive = tar::Archive::new(decoder);\n        archive.set_preserve_permissions(true);\n        archive\n            .unpack(dest)\n            .map_err(|e| anyhow!(\"tar.gz invalido: {}\", e))\n    } else if name.ends_with(\".tar.xz\") {\n        let decoder = xz2::read::XzDecoder::new(std::io::Cursor::new(data));\n        let mut archive = tar::Archive::new(decoder);\n        archive.set_preserve_permissions(true);\n        archive\n            .unpack(dest)\n            .map_err(|e| anyhow!(\"tar.xz invalido: {}\", e))\n    } else {\n        Err(anyhow!(\"formato de pacote desconhecido: {}\", name))\n    }\n}\n\n/// Procura um arquivo pelo nome dentro de uma árvore (os zips do whisper.cpp\n/// e do Real-ESRGAN têm subpastas diferentes por plataforma).\npub fn find_file(root: &Path, file_name: &str) -> Option<PathBuf> {\n    let mut stack = vec![root.to_path_buf()];\n    while let Some(dir) = stack.pop() {\n        let Ok(rd) = std::fs::read_dir(&dir) else {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/github.rs#L123-L159","documentation":"Archive failure in unpack: the downloaded .tar.gz/.tgz could not be decompressed or unpacked by the flate2+tar pipeline — the bytes are truncated, corrupt, or not actually gzip, so extraction is aborted.","triggerScenarios":"Calling unpack() with a .tar.gz/.tgz name whose bytes are corrupt: truncated gzip stream, bad CRC, or data that isn't gzip at all.","commonSituations":"Partial download; asset that is plain tar misnamed as .tar.gz; decompression of an HTML error page saved as the asset.","solutions":["Re-download and verify digest before unpacking","Confirm the file starts with gzip magic bytes (1f 8b)","Read the wrapped inner error for the specific gzip/tar failure"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn looks_like_gzip(data: &[u8]) -> bool {\n    data.starts_with(&[0x1f, 0x8b])\n}\nif !looks_like_gzip(&data) {\n    return Err(\"payload nao e gzip; baixe novamente\".into());\n}\ngithub::unpack(&data, name, &dest)?;","typeGuard":null,"tryCatchPattern":"match github::unpack(&data, name, &dest) {\n    Err(e) if e.to_string().starts_with(\"tar.gz invalido\") => {\n        eprintln!(\"download corrompido; refazendo...\");\n        let data = github::download(&asset).await?;\n        github::unpack(&data, name, &dest)?;\n    }\n    other => other?,\n}","preventionTips":["Enforce digest verification before unpack (use github::download)","Check gzip magic 1f 8b before handing bytes to unpack","Retry the download once automatically on archive errors — corruption is usually transient"],"tags":["github","tar","gzip","archive"],"backgroundTag":"file-read-failed","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"}