tonhowtf/omniget · error

Nenhum URL GIF

Error message

Nenhum URL GIF

What it means

For GIF posts, native_download takes the first entry of available_qualities as the GIF URL and throws this Portuguese-language error if the list is empty. Like the video path, a Gif-typed MediaInfo should always contain at least one quality entry.

Solutions

  1. Inspect parse_media's Gif branch and ensure it always pushes the resolved URL into available_qualities.
  2. Fall back to preview.images[0].variants.mp4.source.url (HTML-unescaped) or the post's url_overridden_by_dest.
  3. Log available_qualities on failure and re-fetch fresh media info (do not use stale cached MediaInfo).
  4. Route redgifs/imgur GIFs to their dedicated extractors instead of the generic gif path.
  5. Translate/unify the error message with the rest of the codebase (English) for consistency.

Example fix

// before
let url = &info.available_qualities.first()
    .ok_or_else(|| anyhow!("Nenhum URL GIF"))?.url;
// after
let url = &info.available_qualities.first()
    .ok_or_else(|| anyhow!("No GIF URL available (qualities empty)"))?.url;
Defensive patterns

Strategy: validation

Validate before calling

if info.media_type == MediaType::Gif && info.available_qualities.is_empty() {
    return Err("media info has no GIF URL; re-fetch or use redgifs extractor");
}

Type guard

fn has_gif_entry(info: &MediaInfo) -> bool {
    info.available_qualities.first().map_or(false, |q| !q.url.is_empty())
}

Try / catch

match download(url, out).await {
    Err(e) if e.to_string().contains("GIF") => {
        let fresh = get_media_info(url).await?;
        download_fresh(fresh, out).await
    }
    other => other,
}

Prevention

When it happens

Trigger: parse_media classified the post as MediaType::Gif (e.g. preview found) but did not append any available_qualities entry; typically when the gif's variants array in preview.images is empty or the mp4 variant is missing.

Common situations: Reddit posts using redgifs/imgur embeds where parse_media marked Gif from metadata but failed to extract a concrete .mp4/.gif URL; schema changes in preview.images.variants (mp4 variant renamed); gallery items flagged as gif without URL extraction.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/src/platforms/reddit/mod.rs:681

                            &output,
                            progress,
                            Some(&opts.cancel_token),
                        )
                        .await?;

                    Ok(DownloadResult {
                        file_path: output,
                        file_size_bytes: bytes,
                        duration_seconds: info.duration_seconds.unwrap_or(0.0),
                        torrent_id: None,
                    })
                }
            }
            MediaType::Gif => {
                let url = &info
                    .available_qualities
                    .first()
                    .ok_or_else(|| anyhow!("Nenhum URL GIF"))?
                    .url;
                let output = opts
                    .output_dir
                    .join(format!("{}.gif", sanitize_filename::sanitize(&info.title)));
                let bytes = direct_downloader::download_direct(
                    &self.client,
                    url,
                    &output,
                    progress,
                    Some(&opts.cancel_token),
                )
                .await?;

                Ok(DownloadResult {
                    file_path: output,
                    file_size_bytes: bytes,
                    duration_seconds: 0.0,
                    torrent_id: None,

View on GitHub (pinned to 8600b91f42)