tonhowtf/omniget · info
Download cancelled
Error message
Download cancelled
What it means
Before each variant download attempt the loop checks the caller-supplied CancellationToken; if cancellation was requested it aborts the whole fallback loop with 'Download cancelled'. This is an intentional cooperative-cancellation error, not a malfunction.
Solutions
- Catch this error and treat it as a normal, expected outcome (no retry, no error toast).
- Check the cancellation token before starting the download at all to avoid starting work that will be aborted.
- Remove the partial output file after a cancelled download.
- Distinguish cancellation from real failures in progress reporting (emit a 'cancelled' state, not 'failed').
Example fix
// before
match native_download(url, opts, progress_tx.clone(), Some(&token)).await {
Err(e) => report_error(e),
Ok(n) => report_done(n),
}
// after
match native_download(url, opts, progress_tx.clone(), Some(&token)).await {
Err(e) if e.to_string().contains("Download cancelled") || token.is_cancelled() => report_cancelled(),
Err(e) => report_error(e),
Ok(n) => report_done(n),
} Defensive patterns
Strategy: try-catch
Validate before calling
// check before starting at all
if token.is_cancelled() { return Ok(()); } Try / catch
match download(url, out, Some(&token)).await {
Err(e) if token.is_cancelled() || e.to_string().contains("cancelled") => {
let _ = tokio::fs::remove_file(out).await; // clean partial output
report_cancelled();
}
Err(e) => report_error(e),
Ok(n) => report_done(n),
} Prevention
- Treat cancellation as an expected state, not a failure
- Check the token before spawning the download task
- Delete partial output files after cancellation
- Use the CancellationToken itself to classify the error rather than string matching
When it happens
Trigger: The user pressed cancel in the UI (or the app dropped the download task) while download_video_with_fallback was iterating resolution variants; the token passed via native_download's cancel Option is triggered between attempts.
Common situations: User cancels a slow Reddit video download; app shutdown cancels in-flight downloads; UI clears a download queue and cancels each token.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/e9177c62920ff314.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/platforms/reddit/mod.rs:218
}
}
variants
}
async fn download_video_with_fallback(
&self,
video_url: &str,
output: &std::path::Path,
progress_tx: mpsc::Sender<ProgressUpdate>,
cancel: Option<&tokio_util::sync::CancellationToken>,
) -> anyhow::Result<u64> {
let variants = Self::get_resolution_variants(video_url);
let mut last_err = anyhow!("No resolution available");
for variant in &variants {
if let Some(token) = cancel {
if token.is_cancelled() {
return Err(anyhow!("Download cancelled"));
}
}
match direct_downloader::download_direct(
&self.client,
variant,
output,
progress_tx.clone(),
cancel,
)
.await
{
Ok(bytes) => return Ok(bytes),
Err(e) => {
last_err = e;
let _ = tokio::fs::remove_file(output).await;
}
}
}View on GitHub (pinned to 8600b91f42)