tonhowtf/omniget · error · anyhow::Error

No URL available

Error message

No URL available

What it means

In direct-file download, the code takes the first entry of `available_qualities`, extracts its URL, and rejects empty strings before downloading. It means the MediaInfo carried no usable direct URL for the file.

Solutions

  1. Inspect the MediaInfo before download and ensure the URL extraction step actually populated a URL.
  2. Validate resolved URLs (non-empty, absolute) in get_media_info and fail early there with a clearer error.
  3. Re-resolve the source URL if the original link expired and retry to get a fresh direct URL.
  4. Fall back to deriving the filename and URL from the original user-supplied link when qualities are empty.

Example fix

// before
let file_url = info.available_qualities.first().map(|q| q.url.as_str()).filter(|u| !u.is_empty()).ok_or_else(|| anyhow!("No URL available"))?;
// after
let file_url = info
    .available_qualities
    .iter()
    .map(|q| q.url.as_str())
    .find(|u| !u.is_empty())
    .ok_or_else(|| anyhow!("No URL available in qualities ({} entries) for {}", info.available_qualities.len(), info.title))?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust, before calling download
let has_url = info
    .available_qualities
    .iter()
    .any(|q| !q.url.is_empty());
if !has_url {
    return Err(anyhow!("Direct file info has no usable URL"));
}

Prevention

When it happens

Trigger: `download` called with MediaInfo whose `available_qualities` is empty, or whose first quality has an empty `url` string.

Common situations: Upstream resolution produced an info record but failed to fill the URL (expired link, failed extraction), or the first quality entry was constructed as a placeholder with an empty URL.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/src/platforms/direct_file/mod.rs:104

            media_type: MediaType::File,
            file_size_bytes,
        })
    }

    async fn download(
        &self,
        info: &MediaInfo,
        opts: &DownloadOptions,
        progress: mpsc::Sender<ProgressUpdate>,
    ) -> anyhow::Result<DownloadResult> {
        let _ = progress.send(ProgressUpdate::percent(0.0)).await;

        let file_url = info
            .available_qualities
            .first()
            .map(|q| q.url.as_str())
            .filter(|u| !u.is_empty())
            .ok_or_else(|| anyhow!("No URL available"))?;

        let filename = sanitize_filename::sanitize(&info.title);
        let filename = if filename.is_empty() {
            filename_from_url(file_url)
        } else {
            filename
        };
        let output_path = opts.output_dir.join(&filename);

        let mut builder = http_client::apply_global_proxy(reqwest::Client::builder())
            .connect_timeout(std::time::Duration::from_secs(30));

        if let Some(ua) = opts.user_agent.as_deref() {
            builder = builder.user_agent(ua);
        }

        let jar = crate::core::cookie_parser::load_extension_cookies_for_url(file_url).or_else(|| {
            opts.referer

View on GitHub (pinned to 8600b91f42)