{"record":{"id":"ca338fe27fe8d82b","repo":"tonhowtf/omniget","slug":"o-yt-dlp-n-o-iniciou","errorCode":null,"errorMessage":"o yt-dlp não iniciou: {}","messagePattern":"o yt-dlp não iniciou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/yt_archive.rs","lineNumber":68,"sourceCode":"        }\n    }\n}\n\nasync fn ytdlp_path() -> anyhow::Result<PathBuf> {\n    crate::core::dependencies::find_tool(\"yt-dlp\")\n        .await\n        .ok_or_else(|| anyhow!(\"o yt-dlp não está instalado\"))\n}\n\n/// Roda o yt-dlp e devolve a saída padrão. Erro traz o fim do stderr.\npub async fn run_ytdlp(args: &[String]) -> anyhow::Result<String> {\n    let bin = ytdlp_path().await?;\n    let out = crate::core::ytdlp::ytdlp_command(&bin)\n        .args(args)\n        .stdin(std::process::Stdio::null())\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"o yt-dlp não iniciou: {}\", e))?;\n    if !out.status.success() {\n        let err = String::from_utf8_lossy(&out.stderr);\n        let tail: Vec<&str> = err.lines().rev().take(3).collect();\n        return Err(anyhow!(\n            \"yt-dlp falhou: {}\",\n            tail.into_iter().rev().collect::<Vec<_>>().join(\" / \")\n        ));\n    }\n    Ok(String::from_utf8_lossy(&out.stdout).to_string())\n}\n\n// ── Estado ─────────────────────────────────────────────────────────────\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]\n#[serde(rename_all = \"lowercase\")]\npub enum ItemStatus {\n    /// Ainda na fila.\n    Pending,","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/yt_archive.rs#L50-L86","documentation":"run_ytdlp spawns the yt-dlp binary with .output(); if the OS fails to spawn the process (binary exists but is not executable, corrupted, or architecture-incompatible), it throws \"o yt-dlp não iniciou: {}\" wrapping the io::Error. This differs from yt-dlp running and failing — the process never started.","triggerScenarios":"Calling enumerate (via run_ytdlp) when the yt-dlp binary found on disk lacks execute permission, is a broken symlink, or is built for a different platform.","commonSituations":"Downloaded binary without chmod +x; partial/corrupted download of the managed tool; Windows-only binary run on Linux via mismatched install; antivirus quarantining the binary.","solutions":["chmod +x the yt-dlp binary (or re-download it via the dependency manager).","Run `yt-dlp --version` directly to see the underlying OS error.","Reinstall yt-dlp for the correct platform/architecture.","Check antivirus/quarantine logs if the binary disappeared or became non-executable."],"exampleFix":"// before\nlet out = run_ytdlp(&args).await?;\n// after\nmatch run_ytdlp(&args).await {\n    Ok(out) => println!(\"{}\", out),\n    Err(e) if e.to_string().contains(\"não iniciou\") => {\n        eprintln!(\"binário yt-dlp quebrado/sem permissão: {e}; reinstale-o\");\n    }\n    Err(e) => return Err(e),\n}","handlingStrategy":"validation","validationCode":"// antes de chamar\nlet path = find_tool(\"yt-dlp\").await.ok_or(anyhow!(\"yt-dlp ausente\"))?;\nlet meta = std::fs::metadata(&path)?;\n#[cfg(unix)]\n{\n    use std::os::unix::fs::PermissionsExt;\n    if meta.permissions().mode() & 0o111 == 0 {\n        return Err(anyhow!(\"yt-dlp sem permissão de execução: {}\", path.display()));\n    }\n}","typeGuard":null,"tryCatchPattern":"match run_ytdlp(&args).await {\n    Ok(out) => out,\n    Err(e) if e.to_string().contains(\"não iniciou\") => {\n        eprintln!(\"falha ao spawnar yt-dlp ({e}); reinstale o binário\");\n        reinstall_ytdlp().await?;\n        run_ytdlp(&args).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["chmod +x the binary after manual downloads","Verify binaries with `yt-dlp --version` after install or update","Download platform-correct binaries (linux/mac/win, right arch)","Re-download if the managed tool directory was partially written"],"tags":["process-spawn","yt-dlp","io"],"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-23T08:17:48.524Z"}