{"record":{"id":"5d5ea5b633894c15","repo":"tonhowtf/omniget","slug":"o-yt-dlp-n-o-est-dispon-vel","errorCode":null,"errorMessage":"o yt-dlp não está disponível: {}","messagePattern":"o yt-dlp não está disponível: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":400,"sourceCode":"    let l = line.trim();\n    if !l.starts_with(\"[download]\") {\n        return None;\n    }\n    let pct = l.split_whitespace().find(|w| w.ends_with('%'))?;\n    pct.trim_end_matches('%').parse::<f64>().ok()\n}\n\nasync fn run_ytdlp(\n    url: &str,\n    dest: &Path,\n    base: &str,\n    opts: &Options,\n    progress: &ProgressFn,\n) -> Result<(Vec<String>, String)> {\n    use tokio::io::{AsyncBufReadExt, BufReader};\n    let bin = crate::core::ytdlp::ensure_ytdlp()\n        .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();","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L382-L418","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install yt-dlp manually (pip install yt-dlp) and put it on PATH","Ensure network access so ensure_ytdlp can auto-download the binary","Check that the app's tools/data directory is writable","Read the wrapped inner error for the precise cause (download vs exec failure)"],"exampleFix":"// before: relying on auto-download\n// after: verify availability up front\nif which::which(\"yt-dlp\").is_err() {\n    eprintln!(\"instale o yt-dlp: pip install yt-dlp\");\n    return;\n}","handlingStrategy":"validation","validationCode":"if which::which(\"yt-dlp\").is_err()\n    && !std::path::Path::new(\"tools/yt-dlp\").exists() {\n    eprintln!(\"instale yt-dlp antes de baixar: pip install yt-dlp\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-install yt-dlp in deployments/containers so no runtime download is needed","Pin yt-dlp in requirements/Dockerfile and update it regularly","Ensure the tools directory is writable for the auto-downloader"],"tags":["yt-dlp","missing-dependency","external-tool","rust"],"backgroundTag":"missing-dependency","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"}