tonhowtf/omniget · info

Download cancelado

Error message

Download cancelado

What it means

anyhow::bail! raised inside `download_playlist` when `opts.cancel_token.is_cancelled()` becomes true before starting the next video in the playlist loop. This is an intentional cooperative-cancellation error: the playlist download stops partway, carrying the count of already-successful items via success_count.

Solutions

  1. Treat this message as an expected user-intent outcome, not a failure — check cancel_token state or match on the message and suppress error UI
  2. Show partial-success info using success_count (N of M videos completed)
  3. Clear/reset the cancel token after cancellation so subsequent downloads are not immediately aborted

Example fix

// before
match download_playlist(...) { Err(e) => show_error(e) }
// after
if let Err(e) = download_playlist(...) {
    if e.to_string() != "Download cancelado" { show_error(e); }
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check: if opts.cancel_token.is_cancelled() { return early before starting }

Try / catch

match download_playlist(...) {
    Err(e) if e.to_string() == "Download cancelado" => log::info!("cancelled by user"),
    Err(e) => show_error(e),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: User clicks cancel in the UI while a YouTube playlist download loop is iterating `info.available_qualities` entries; each iteration checks the cancel token and aborts with this message.

Common situations: User realizes playlist is too large and cancels mid-run; app shutdown triggers the cancel token; duplicate cancel requests from the frontend while previous loop is still draining progress channels.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/e75b319f534a77ff. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/youtube/mod.rs:400

        opts: &DownloadOptions,
        progress: mpsc::Sender<ProgressUpdate>,
        ytdlp_path: &std::path::Path,
        quality_height: Option<u32>,
    ) -> anyhow::Result<DownloadResult> {
        let playlist_dir = opts
            .output_dir
            .join(sanitize_filename::sanitize(&info.title));
        tokio::fs::create_dir_all(&playlist_dir).await?;

        let total = info.available_qualities.len();
        let mut total_bytes = 0u64;
        let mut last_path = playlist_dir.clone();
        let mut success_count = 0usize;
        let mut last_err: Option<anyhow::Error> = None;

        for (i, entry) in info.available_qualities.iter().enumerate() {
            if opts.cancel_token.is_cancelled() {
                anyhow::bail!("Download cancelado");
            }

            let (video_tx, mut video_rx) = mpsc::channel::<ProgressUpdate>(16);
            let progress_tx = progress.clone();
            let video_idx = i;
            let video_total = total;
            let forwarder = tokio::spawn(async move {
                let mut max_pct = 0.0_f64;
                while let Some(pu) = video_rx.recv().await {
                    max_pct = max_pct.max(pu.percent);
                    let overall = (video_idx as f64 / video_total as f64) * 100.0
                        + (max_pct / video_total as f64);
                    let _ = progress_tx
                        .send(ProgressUpdate::rich(
                            overall,
                            None,
                            None,
                            pu.speed_bps,

View on GitHub (pinned to 8600b91f42)