tonhowtf/omniget · error

Torrent download failed

Error message

Torrent download failed: {}

What it means

magnet.rs throws this when the torrent completion future itself returns Err — i.e. librqbit's own download failed — and download() re-raises it as 'Torrent download failed: {}'. The wrapped inner error from the torrent handle carries the actual cause (no peers, tracker failure, disk error, etc.).

Solutions

  1. Inspect the wrapped inner error (text after the prefix) to identify the root cause.
  2. Check swarm health: seeders/peer count and tracker status for this torrent before retrying.
  3. Verify output_dir is writable and has enough free space for the full payload.
  4. For magnets, add working trackers or enable DHT so metadata/peers can be found.
  5. Implement a bounded retry with backoff for transient peer/tracker failures.

Example fix

// before
match downloader.download(opts, progress).await {
    Err(e) => show_error(e),
    ...
}
// after
match downloader.download(opts, progress).await {
    Err(e) if e.to_string().starts_with("Torrent download failed:") => {
        let cause = e.to_string();
        if swarm_has_no_peers(&cause) {
            schedule_retry_with_backoff(opts); // transient
        } else {
            show_error(e); // disk/io/config issue
        }
    }
    ...
}
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight checks
assert_dir_writable_and_has_space(&opts.output_dir, expected_size)?;

Try / catch

Err(e) if e.to_string().starts_with("Torrent download failed:") => {
    if is_transient(&e) { retry_with_backoff(3) } else { propagate(e) }
}

Prevention

When it happens

Trigger: In the select loop, `res = &mut completion` yields Err(e) and magnet.rs:270 bails with the message plus the inner error. Happens whenever the torrent's downloading future terminates unsuccessfully before reaching 100%.

Common situations: Torrent with no seeders/peers; all trackers unreachable or DHT disabled; insufficient disk space for the payload; permission errors writing to output_dir; metadata never received for a magnet with no peers.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/magnet.rs:270

                        );
                        // Fallback: detect completion from stats when
                        // wait_until_completed() doesn't resolve
                        if downloaded >= total {
                            tracing::info!("[magnet] download complete from stats (id={})", torrent_id);
                            break;
                        }
                    }
                }
                _ = cancel_rx.cancelled() => {
                    tracing::info!("[magnet] download cancelled, removing torrent id={}", torrent_id);
                    if let Err(e) = session_for_cancel.delete(TorrentIdOrHash::Id(torrent_id), false).await {
                        tracing::warn!("[magnet] failed to delete torrent on cancel: {}", e);
                    }
                    anyhow::bail!("Download cancelled");
                }
                res = &mut completion => {
                    if let Err(e) = res {
                        anyhow::bail!("Torrent download failed: {}", e);
                    }
                    let _ = progress.send(ProgressUpdate::percent(100.0)).await;
                    tracing::info!("[magnet] download complete (id={})", torrent_id);
                    break;
                }
            }
        }

        let (total_size, torrent_name) = managed_torrent
            .with_metadata(|meta| {
                let size = meta
                    .info
                    .iter_file_lengths()
                    .ok()
                    .map(|iter| iter.sum::<u64>())
                    .unwrap_or_else(|| meta.file_infos.iter().map(|f| f.len).sum());
                let name = meta
                    .info

View on GitHub (pinned to 8600b91f42)