tonhowtf/omniget · error

não foi possível iniciar o yt-dlp

Error message

não foi possível iniciar o yt-dlp: {}

What it means

After resolving the yt-dlp binary path, run_ytdlp builds the command and calls spawn(); if the OS fails to start the process (binary not executable, missing interpreter, exec format error), the raw io::Error is wrapped as "não foi possível iniciar o yt-dlp". This differs from the availability error: the binary was found but could not be executed.

Solutions

  1. chmod +x the yt-dlp binary in the app's tools directory
  2. Delete and re-download the binary (it may be truncated/corrupt)
  3. Verify the binary matches the OS and CPU architecture (file $(which yt-dlp))
  4. Reinstall yt-dlp via pip to get a platform-correct binary
  5. Check MAC policies (SELinux/AppArmor) that forbid executing from the data dir

Example fix

// before: corrupted binary
$ ./tools/yt-dlp
zsh: exec format error
// after
$ rm tools/yt-dlp && pip install yt-dlp
$ chmod +x $(which yt-dlp)
Defensive patterns

Strategy: try-catch

Validate before calling

let p = which::which("yt-dlp")?;
let meta = std::fs::metadata(&p)?;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
#[cfg(unix)]
if meta.permissions().mode() & 0o111 == 0 {
    eprintln!("yt-dlp sem permissão de execução: chmod +x {:?}", p);
}

Try / catch

match run(&args).await {
    Err(e) if e.to_string().contains("não foi possível iniciar") => {
        eprintln!("binário yt-dlp corrompido/plataforma errada; reinstale");
    }
    other => other?,
}

Prevention

When it happens

Trigger: yt-dlp binary exists but lacks the executable bit, is a stub/placeholder file, was corrupted during auto-download, or is a Windows binary being run on Linux (or vice-versa).

Common situations: Downloaded binary lost +x permission after extraction, partial download leaving a truncated file, wrong-architecture binary, AppArmor/SELinux blocking exec from the data directory.

Related errors


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

Appendix: source

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

        .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();
    let stderr = child.stderr.take();
    let p = progress.clone();
    let out_task = tokio::spawn(async move {
        let mut files: Vec<String> = Vec::new();
        if let Some(o) = stdout {
            let mut lines = BufReader::new(o).lines();
            while let Ok(Some(line)) = lines.next_line().await {
                if let Some(path) = line.trim().strip_prefix(MARK) {
                    if !path.is_empty() && !files.iter().any(|f| f == path) {
                        files.push(path.to_string());
                    }
                    continue;
                }
                if let Some(pct) = parse_progress(&line) {
                    report(&p, ID, "progress", pct.round() as u64, Some(100), None);
                }
            }

View on GitHub (pinned to 8600b91f42)