tonhowtf/omniget · error
yt-dlp falhou
Error message
yt-dlp falhou: {} What it means
run_ytdlp checks the process exit status; when yt-dlp runs but exits non-zero, it throws "yt-dlp falhou: {}" containing the last 3 lines of yt-dlp's stderr. The library surfaces yt-dlp's own diagnostics because the failure cause (bad URL, region lock, format issue) comes from yt-dlp itself.
Solutions
- Read the stderr tail in the error message — it names the actual yt-dlp failure.
- Update yt-dlp to the latest version (pip install -U yt-dlp); YouTube breakage is usually fixed within days.
- If the error mentions sign-in/cookies, refresh the session cookie file or export fresh cookies.
- Check the URL is a valid, public playlist/video; retry after backoff if it mentions rate limiting or bot detection.
Example fix
// before
let json = run_ytdlp(&args).await?;
// after
let json = match run_ytdlp(&args).await {
Ok(j) => j,
Err(e) => {
eprintln!("yt-dlp: {e}; tentando atualizar yt-dlp...");
let _ = Command::new("pip").args(["install", "-U", "yt-dlp"]).status();
run_ytdlp(&args).await?
}
}; Defensive patterns
Strategy: retry
Try / catch
match run_ytdlp(&args).await {
Ok(out) => out,
Err(e) if e.to_string().contains("yt-dlp falhou") => {
eprintln!("{e}");
if e.to_string().to_lowercase().contains("update") || e.to_string().contains("unable to extract") {
update_ytdlp().await?;
run_ytdlp(&args).await?
} else { return Err(e); }
}
Err(e) => return Err(e),
} Prevention
- Keep yt-dlp up to date (nightly releases fix YouTube breakage fast)
- Read the stderr tail embedded in the error for the root cause
- Refresh session cookies before they expire
- Back off and retry on rate-limit/bot-check messages
When it happens
Trigger: Calling enumerate when yt-dlp exits non-zero: unsupported/private/deleted video, network failure, outdated yt-dlp version facing a YouTube layout change, bad cookie file, or invalid CLI args.
Common situations: YouTube breaking yt-dlp until an update ships; expired YouTube session cookies in the netscape file; private playlists without cookies; rate limiting/bot checks.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- vimeo:{code}
- não achei nenhum vídeo nessa URL (Watch Later precisa da…
- Playlist empty or unavailable
- Livestreams not supported
- YouTube requires yt-dlp. Failed to get yt-dlp
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/85fbb13f0f7d0547.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/yt_archive.rs:72
async fn ytdlp_path() -> anyhow::Result<PathBuf> {
crate::core::dependencies::find_tool("yt-dlp")
.await
.ok_or_else(|| anyhow!("o yt-dlp não está instalado"))
}
/// Roda o yt-dlp e devolve a saída padrão. Erro traz o fim do stderr.
pub async fn run_ytdlp(args: &[String]) -> anyhow::Result<String> {
let bin = ytdlp_path().await?;
let out = crate::core::ytdlp::ytdlp_command(&bin)
.args(args)
.stdin(std::process::Stdio::null())
.output()
.await
.map_err(|e| anyhow!("o yt-dlp não iniciou: {}", e))?;
if !out.status.success() {
let err = String::from_utf8_lossy(&out.stderr);
let tail: Vec<&str> = err.lines().rev().take(3).collect();
return Err(anyhow!(
"yt-dlp falhou: {}",
tail.into_iter().rev().collect::<Vec<_>>().join(" / ")
));
}
Ok(String::from_utf8_lossy(&out.stdout).to_string())
}
// ── Estado ─────────────────────────────────────────────────────────────
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum ItemStatus {
/// Ainda na fila.
Pending,
/// Baixado (ou já presente no `--download-archive`).
Ok,
/// Tentou e deu erro; o motivo fica no item.
Failed,View on GitHub (pinned to 8600b91f42)