tonhowtf/omniget · error

o yt-dlp não está disponível

Error message

o yt-dlp não está disponível: {}

What it means

run_ytdlp first calls ensure_ytdlp(), which locates or downloads the yt-dlp binary; if that fails (binary missing, download failed, unsupported platform), the error is wrapped as "o yt-dlp não está disponível". The download run aborts before any yt-dlp invocation because the tool is a hard dependency.

Solutions

  1. Install yt-dlp manually (pip install yt-dlp) and put it on PATH
  2. Ensure network access so ensure_ytdlp can auto-download the binary
  3. Check that the app's tools/data directory is writable
  4. Read the wrapped inner error for the precise cause (download vs exec failure)

Example fix

// before: relying on auto-download
// after: verify availability up front
if which::which("yt-dlp").is_err() {
    eprintln!("instale o yt-dlp: pip install yt-dlp");
    return;
}
Defensive patterns

Strategy: validation

Validate before calling

if which::which("yt-dlp").is_err()
    && !std::path::Path::new("tools/yt-dlp").exists() {
    eprintln!("instale yt-dlp antes de baixar: pip install yt-dlp");
}

Prevention

When it happens

Trigger: Calling the reddit download run flow when yt-dlp is neither on PATH nor in the app's tools directory and ensure_ytdlp cannot fetch it — no network to download it, unsupported architecture, or blocked filesystem write.

Common situations: Fresh install without yt-dlp, offline/air-gapped environment preventing the auto-download, PATH not including the app's bin dir, antivirus removing the downloaded binary.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/download.rs:400

    let l = line.trim();
    if !l.starts_with("[download]") {
        return None;
    }
    let pct = l.split_whitespace().find(|w| w.ends_with('%'))?;
    pct.trim_end_matches('%').parse::<f64>().ok()
}

async fn run_ytdlp(
    url: &str,
    dest: &Path,
    base: &str,
    opts: &Options,
    progress: &ProgressFn,
) -> Result<(Vec<String>, String)> {
    use tokio::io::{AsyncBufReadExt, BufReader};
    let bin = crate::core::ytdlp::ensure_ytdlp()
        .await
        .map_err(|e| anyhow!("o yt-dlp não está disponível: {}", e))?;
    let ffmpeg = crate::core::dependencies::find_tool("ffmpeg").await;
    let args = ytdlp_args(
        url,
        dest,
        base,
        opts.audio_only,
        ffmpeg.as_deref(),
        opts.cookies.as_deref(),
    );
    let mut cmd = crate::core::ytdlp::ytdlp_command(&bin);
    cmd.args(&args)
        .stdin(std::process::Stdio::null())
        .stdout(std::process::Stdio::piped())
        .stderr(std::process::Stdio::piped());
    let mut child = cmd
        .spawn()
        .map_err(|e| anyhow!("não foi possível iniciar o yt-dlp: {}", e))?;
    let stdout = child.stdout.take();

View on GitHub (pinned to 8600b91f42)