tonhowtf/omniget · info
Download cancelled
Error message
Download cancelled
What it means
The gallery-dl wrapper spawns the gallery-dl process and selects between child.wait() and the cancel token's cancelled() future. On cancellation it kills the child, drains stdout/stderr tasks, and bails with 'Download cancelled'.
Solutions
- Treat as expected abort: catch the error, report partial files already written, and clean temp dirs.
- If pausing is intended, add a pause mechanism instead of cancelling the token.
- Avoid sharing one cancel token across unrelated downloads if only one should stop.
Defensive patterns
Strategy: try-catch
Validate before calling
if opts.cancel_token.is_cancelled() {
return Err(anyhow!("Download cancelled")); // skip spawning gallery-dl
} Try / catch
match download(url, opts).await {
Err(e) if e.to_string() == "Download cancelled" => {
cleanup_partial_output(&out_dir);
}
other => other?,
} Prevention
- Scope cancel tokens per download so aborting one doesn't kill others
- Track already-downloaded files for resume
- Distinguish user cancellation from process failure in logs
When it happens
Trigger: Signalling opts.cancel_token while a gallery-dl child process is running (waiting for it to exit); calling download and cancelling before the process finishes.
Common situations: User aborts a gallery-based download mid-run; app shutdown cancels all tokens; UI timeout cancels a slow gallery-dl fetch.
Related errors
- Download cancelled by user
- Send cancelled while waiting for receiver
- Send cancelled while paused
- Download cancelled
- Download cancelled during session creation
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/ba2af8bcbf0faee2.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/src/platforms/gallerydl/mod.rs:287
});
let stderr_task = tokio::spawn(async move {
let mut buf = String::new();
let mut lines = BufReader::new(stderr_pipe).lines();
while let Ok(Some(line)) = lines.next_line().await {
buf.push_str(&line);
buf.push('\n');
}
buf
});
let status = tokio::select! {
s = child.wait() => s.map_err(|e| anyhow!("gallery-dl process failed: {}", e))?,
_ = opts.cancel_token.cancelled() => {
let _ = child.kill().await;
let _ = reader_task.await;
let _ = stderr_task.await;
anyhow::bail!("Download cancelled");
}
};
let _ = reader_task.await;
let stderr_content = stderr_task.await.unwrap_or_default();
if !status.success() {
let detail = stderr_content
.lines()
.rev()
.find(|l| {
let l = l.to_lowercase();
l.contains("error")
|| l.contains("forbidden")
|| l.contains("not found")
|| l.contains("unsupported")
})
.unwrap_or("gallery-dl failed")View on GitHub (pinned to 8600b91f42)