{"record":{"id":"fe4747c663a21a52","repo":"tonhowtf/omniget","slug":"n-o-foi-poss-vel-iniciar-o-yt-dlp","errorCode":null,"errorMessage":"não foi possível iniciar o yt-dlp: {}","messagePattern":"não foi possível iniciar o yt-dlp: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":417,"sourceCode":"        .await\n        .map_err(|e| anyhow!(\"o yt-dlp não está disponível: {}\", e))?;\n    let ffmpeg = crate::core::dependencies::find_tool(\"ffmpeg\").await;\n    let args = ytdlp_args(\n        url,\n        dest,\n        base,\n        opts.audio_only,\n        ffmpeg.as_deref(),\n        opts.cookies.as_deref(),\n    );\n    let mut cmd = crate::core::ytdlp::ytdlp_command(&bin);\n    cmd.args(&args)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"não foi possível iniciar o yt-dlp: {}\", e))?;\n    let stdout = child.stdout.take();\n    let stderr = child.stderr.take();\n    let p = progress.clone();\n    let out_task = tokio::spawn(async move {\n        let mut files: Vec<String> = Vec::new();\n        if let Some(o) = stdout {\n            let mut lines = BufReader::new(o).lines();\n            while let Ok(Some(line)) = lines.next_line().await {\n                if let Some(path) = line.trim().strip_prefix(MARK) {\n                    if !path.is_empty() && !files.iter().any(|f| f == path) {\n                        files.push(path.to_string());\n                    }\n                    continue;\n                }\n                if let Some(pct) = parse_progress(&line) {\n                    report(&p, ID, \"progress\", pct.round() as u64, Some(100), None);\n                }\n            }","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L399-L435","documentation":"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.","triggerScenarios":"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).","commonSituations":"Downloaded binary lost +x permission after extraction, partial download leaving a truncated file, wrong-architecture binary, AppArmor/SELinux blocking exec from the data directory.","solutions":["chmod +x the yt-dlp binary in the app's tools directory","Delete and re-download the binary (it may be truncated/corrupt)","Verify the binary matches the OS and CPU architecture (file $(which yt-dlp))","Reinstall yt-dlp via pip to get a platform-correct binary","Check MAC policies (SELinux/AppArmor) that forbid executing from the data dir"],"exampleFix":"// before: corrupted binary\n$ ./tools/yt-dlp\nzsh: exec format error\n// after\n$ rm tools/yt-dlp && pip install yt-dlp\n$ chmod +x $(which yt-dlp)","handlingStrategy":"try-catch","validationCode":"let p = which::which(\"yt-dlp\")?;\nlet meta = std::fs::metadata(&p)?;\n#[cfg(unix)]\nuse std::os::unix::fs::PermissionsExt;\n#[cfg(unix)]\nif meta.permissions().mode() & 0o111 == 0 {\n    eprintln!(\"yt-dlp sem permissão de execução: chmod +x {:?}\", p);\n}","typeGuard":null,"tryCatchPattern":"match run(&args).await {\n    Err(e) if e.to_string().contains(\"não foi possível iniciar\") => {\n        eprintln!(\"binário yt-dlp corrompido/plataforma errada; reinstale\");\n    }\n    other => other?,\n}","preventionTips":["After any manual binary install, verify it runs: yt-dlp --version","Re-download the binary if a download was interrupted","Check SELinux/AppArmor exec restrictions on the tools directory"],"tags":["yt-dlp","process-spawn","io-error","rust"],"backgroundTag":"command-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"}