tonhowtf/omniget · info

Download cancelado

Error message

Download cancelado

What it means

This error is thrown in the download queue worker when the tokio select! race resolves in favor of the cancellation token instead of the download future. It means the user (or the queue manager) requested cancellation of this download while it was still in flight. The download is aborted and the task completes with this error instead of a result.

Solutions

  1. Treat this error as an expected control-flow signal, not a failure: match on the message or use a dedicated Cancelled error type before reporting to the UI
  2. If cancellation is unexpected, check what code calls cancel_token.cancel() (UI handler, queue cleanup) and confirm it should fire at that moment
  3. Ensure partial files from the cancelled download are cleaned up in the same error path

Example fix

// before
Err(anyhow::anyhow!("Download cancelado"))
// after
#[derive(thiserror::Error, Debug)]
#[error("Download cancelado")]
pub struct DownloadCancelled;
// then in the queue loop:
if e.is::<DownloadCancelled>() { /* mark item as cancelled, not failed */ }
Defensive patterns

Strategy: try-catch

Try / catch

match queue_result {
    Err(e) if e.to_string().contains("Download cancelado") => mark_item_cancelled(item),
    Err(e) => report_failure(item, e),
    Ok(res) => mark_item_done(item, res),
}

Prevention

When it happens

Trigger: cancel_token.cancelled() fires before downloader.download() completes; e.g. the user hits cancel in the UI, the queue is cleared, or the app shuts down while a download is active.

Common situations: User cancels a slow or large Bilibili download; queue manager aborts stale entries; window close triggers a graceful shutdown that cancels in-flight downloads.

Related errors


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

Appendix: source

Thrown at src-tauri/src/core/queue.rs:1738

    }
    if let Some(hdrs) = opts.extra_headers.clone() {
        omniget_core::core::ytdlp::register_ext_headers(url.clone(), hdrs);
    }

    let dl_start = std::time::Instant::now();
    append_download_log(
        &app,
        item_id,
        format!(
            "[omniget] starting download: platform={} title=\"{}\" url={}",
            platform_name, log_title, url
        ),
    );
    let dl_future = async {
        tokio::select! {
            r = downloader.download(&info, &opts, tx) => r,
            _ = cancel_token.cancelled() => {
                Err(anyhow::anyhow!("Download cancelado"))
            }
        }
    };
    if let Some(argv) = argv_override.as_ref() {
        append_download_log(
            &app,
            item_id,
            format!(
                "[omniget] running user-edited command ({} args), single attempt",
                argv.len()
            ),
        );
    }
    let result = omniget_core::core::log_hook::CURRENT_ARGV_OVERRIDE
        .scope(
            argv_override.clone(),
            omniget_core::core::log_hook::CURRENT_COOKIE_SLUG.scope(
                cookie_slug.clone(),

View on GitHub (pinned to 8600b91f42)