{"record":{"id":"ece471bd734e8cd4","repo":"tonhowtf/omniget","slug":"n-o-foi-poss-vel-iniciar-o-yt-dlp-e","errorCode":null,"errorMessage":"não foi possível iniciar o yt-dlp: {e}","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/vimeo.rs","lineNumber":751,"sourceCode":"}\n\n// ───────────────────────── execução ─────────────────────────\n\nasync fn ytdlp_bin() -> Result<PathBuf> {\n    crate::core::ytdlp::ensure_ytdlp()\n        .await\n        .map_err(|e| anyhow!(\"o yt-dlp não está disponível: {e}\"))\n}\n\n/// Roda o yt-dlp e devolve o stdout inteiro. Usado só pela enumeração.\nasync fn run_json(bin: &Path, args: &[String], secrets: &[&str]) -> Result<String> {\n    let _slot = crate::core::ytdlp::acquire_ytdlp_slot(\"vimeo-list\").await;\n    let mut cmd = crate::core::ytdlp::ytdlp_command(bin);\n    cmd.args(args).stdin(std::process::Stdio::null());\n    let out = cmd\n        .output()\n        .await\n        .map_err(|e| anyhow!(\"não foi possível iniciar o yt-dlp: {e}\"))?;\n    if !out.status.success() {\n        let tail = scrub(&String::from_utf8_lossy(&out.stderr), secrets);\n        let msg = tail\n            .lines()\n            .rev()\n            .find(|l| !l.trim().is_empty())\n            .unwrap_or(\"\")\n            .to_string();\n        return Err(match error_code(&msg) {\n            Some(code) => anyhow!(\"vimeo:{code}\"),\n            None => anyhow!(\"{}\", msg),\n        });\n    }\n    Ok(String::from_utf8_lossy(&out.stdout).to_string())\n}\n\n/// O que sobrou de um download. `tail` já passou pelo `scrub`.\nstruct DownloadOutcome {","sourceCodeStart":733,"sourceCodeEnd":769,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/vimeo.rs#L733-L769","documentation":"Thrown by run_json in vimeo.rs when spawning the yt-dlp child process fails (cmd.output() io error) at vimeo.rs:751. yt-dlp was resolved to a path but exec failed — distinct from a non-zero yt-dlp exit, which produces the vimeo:{code} or raw-stderr errors instead.","triggerScenarios":"run_json building `ytdlp_command(bin)` and calling .output(): exec fails because the resolved path no longer exists, the file lost its exec bit, the interpreter in its shebang is missing, or fork/resource limits block spawn.","commonSituations":"Managed yt-dlp download removed by a cleanup job between ensure and spawn; script-mode install whose `python3` is absent; ENOEXEC on a truncated/corrupt download; low fd/process limits under concurrent enumeration.","solutions":["Check the wrapped io::Error kind: NotFound means the resolved path vanished — re-run ensure_ytdlp to reinstall.","Verify the binary is executable (`ls -l $(which yt-dlp)`) and its shebang interpreter exists (`head -1 $(which yt-dlp)`).","If spawn fails under load, raise process/fd limits or serialize yt-dlp invocations.","Re-download yt-dlp if the file is corrupt (`yt-dlp -U` or delete the managed copy and retry)."],"exampleFix":"// before\nlet out = cmd.output().await.map_err(|e| anyhow!(\"não foi possível iniciar o yt-dlp: {e}\"))?;\n// after: self-heal once\nlet out = match cmd.output().await {\n    Ok(o) => o,\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        crate::core::ytdlp::ensure_ytdlp().await?;\n        cmd.output().await? \n    }\n    Err(e) => return Err(anyhow!(\"não foi possível iniciar o yt-dlp: {e}\")),\n};","handlingStrategy":"retry","validationCode":"let bin = ytdlp_bin().await?;\nif !bin.exists() {\n    crate::core::ytdlp::ensure_ytdlp().await?; // re-acquire before spawning\n}","typeGuard":null,"tryCatchPattern":"match run_json(&bin, &args, &secrets).await {\n    Err(e) if e.to_string().contains(\"não foi possível iniciar o yt-dlp\") => {\n        let bin2 = ytdlp_bin().await?; // re-resolve and retry once\n        run_json(&bin2, &args, &secrets).await\n    }\n    other => other,\n}","preventionTips":["Re-verify the yt-dlp path exists immediately before spawning","Never run cleanup jobs that delete the managed yt-dlp binary during sessions","Check the shebang interpreter (`python3`) exists for script-mode installs","Serialize yt-dlp spawns (the acquire_ytdlp_slot pattern) to avoid resource-limit failures"],"tags":["yt-dlp","process-spawn","vimeo","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"}