tonhowtf/omniget · error

Nenhum URL de imagem

Error message

Nenhum URL de imagem

What it means

For MediaType::Photo posts, native_download takes the first available_qualities entry for the image URL and format; if the list is empty it throws the Portuguese message "Nenhum URL de imagem". The post was classified as a photo but no image URL was captured during parsing.

Solutions

  1. Inspect the post JSON's preview / gallery_data / media_metadata fields to see what parse_media missed.
  2. Extend parse_media to enumerate all gallery items and produce a quality entry for each.
  3. Re-fetch media info and retry in case the earlier response was truncated.
  4. Handle empty qualities as 'image unavailable' in the UI instead of a raw error.
Defensive patterns

Strategy: type-guard

Validate before calling

// before download, ensure an image URL exists
fn has_image_entry(info: &MediaInfo) -> bool {
    info.media_type == MediaType::Photo
        && info.available_qualities.first().map(|q| !q.url.is_empty()).unwrap_or(false)
}

Type guard

fn image_quality(info: &MediaInfo) -> Option<&Quality> {
    if info.media_type != MediaType::Photo { return None; }
    info.available_qualities.first().filter(|q| !q.url.is_empty())
}

Try / catch

match native_download(opts).await {
    Err(e) if e.to_string() == "Nenhum URL de imagem" => {
        show_user("Image source unavailable (removed or unsupported host)");
    }
    other => other,
}

Prevention

When it happens

Trigger: native_download on a Photo-typed MediaInfo whose available_qualities is empty — e.g. i.redd.it previews missing, gallery items unparseable, or imgur/external-hosted images not resolvable.

Common situations: Gallery posts where only some items parse, removed images (Reddit returns placeholder 'removed' previews), or external image hosts blocking the fetch.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/reddit.rs:706

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

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

                Ok(DownloadResult {
                    file_path: output,
                    file_size_bytes: bytes,

View on GitHub (pinned to 8600b91f42)