tonhowtf/omniget · error · anyhow::Error

Failed to read entry path

Error message

Failed to read entry path: {}

What it means

For each tar member, extract_tar_xz_ffmpeg calls entry.path() to get the member's path before matching against the ffmpeg/ffprobe names. If the path bytes are not valid data (header read failure) entry.path() returns Err, wrapped into this message. Note that non-UTF-8 names are handled separately via unwrap_or("") and do not trigger this.

Solutions

  1. Re-download from the official FFmpeg source to rule out corruption
  2. Repack or inspect the archive with tar -tvf to find the offending member
  3. Update the tar crate; long-path/pax handling improves across versions
  4. Fall back to matching on the raw header bytes if entry.path() keeps failing on a known-good archive

Example fix

// before
let path = entry
    .path()
    .map_err(|e| anyhow!("Failed to read entry path: {}", e))?;
// after
let path = entry
    .path()
    .map_err(|e| anyhow!("Failed to read entry path (skipping member): {}", e))
    .or_else(|_| entry.path_raw().map(PathBuf::from))?;
Defensive patterns

Strategy: type-guard

Type guard

fn entry_name_ok(e: &tar::Entry<'_, impl std::io::Read>) -> bool {
    e.path().map(|p| p.file_name().is_some()).unwrap_or(false)
}

Try / catch

let path = match entry.path() {
    Ok(p) => p,
    Err(_) => continue, // skip unreadable member instead of aborting the whole install
};

Prevention

When it happens

Trigger: tar member whose path header cannot be decoded/read from the underlying xz stream; corruption in the header block; pax/GNU long-name extension data that is malformed.

Common situations: Archives with GNU long filenames or unusual encodings produced by nonstandard tarring tools; corrupted mid-stream downloads; hand-crafted archives.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


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

Appendix: source

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

    let bin_dir = bin_dir.to_path_buf();
    let ffmpeg_name = ffmpeg_name.to_string();
    let ffprobe_name = ffprobe_name.to_string();

    tokio::task::spawn_blocking(move || {
        let file = std::fs::File::open(&archive_path)
            .map_err(|e| anyhow!("Failed to open archive: {}", e))?;
        let decompressor = xz2::read::XzDecoder::new(file);
        let mut archive = tar::Archive::new(decompressor);
        let targets = [ffmpeg_name.as_str(), ffprobe_name.as_str()];

        for entry_result in archive
            .entries()
            .map_err(|e| anyhow!("Failed to read tar entries: {}", e))?
        {
            let mut entry = entry_result.map_err(|e| anyhow!("Failed to read tar entry: {}", e))?;
            let path = entry
                .path()
                .map_err(|e| anyhow!("Failed to read entry path: {}", e))?;
            let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
            for target in &targets {
                if file_name == *target {
                    let dest = bin_dir.join(format!("{}.new", target));
                    let mut out = std::fs::File::create(&dest)?;
                    std::io::copy(&mut entry, &mut out)?;
                    break;
                }
            }
        }
        Ok::<(), anyhow::Error>(())
    })
    .await
    .map_err(|e| anyhow!("Spawn blocking failed: {}", e))??;
    Ok(())
}

// --- aria2c ---

View on GitHub (pinned to 8600b91f42)