{"record":{"id":"918e32480acc044b","repo":"tonhowtf/omniget","slug":"nenhum-url-gif-mod","errorCode":null,"errorMessage":"Nenhum URL GIF","messagePattern":"Nenhum URL GIF","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/reddit/mod.rs","lineNumber":681,"sourceCode":"                            &output,\n                            progress,\n                            Some(&opts.cancel_token),\n                        )\n                        .await?;\n\n                    Ok(DownloadResult {\n                        file_path: output,\n                        file_size_bytes: bytes,\n                        duration_seconds: info.duration_seconds.unwrap_or(0.0),\n                        torrent_id: None,\n                    })\n                }\n            }\n            MediaType::Gif => {\n                let url = &info\n                    .available_qualities\n                    .first()\n                    .ok_or_else(|| anyhow!(\"Nenhum URL GIF\"))?\n                    .url;\n                let output = opts\n                    .output_dir\n                    .join(format!(\"{}.gif\", sanitize_filename::sanitize(&info.title)));\n                let bytes = direct_downloader::download_direct(\n                    &self.client,\n                    url,\n                    &output,\n                    progress,\n                    Some(&opts.cancel_token),\n                )\n                .await?;\n\n                Ok(DownloadResult {\n                    file_path: output,\n                    file_size_bytes: bytes,\n                    duration_seconds: 0.0,\n                    torrent_id: None,","sourceCodeStart":663,"sourceCodeEnd":699,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/reddit/mod.rs#L663-L699","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect parse_media's Gif branch and ensure it always pushes the resolved URL into available_qualities.","Fall back to preview.images[0].variants.mp4.source.url (HTML-unescaped) or the post's url_overridden_by_dest.","Log available_qualities on failure and re-fetch fresh media info (do not use stale cached MediaInfo).","Route redgifs/imgur GIFs to their dedicated extractors instead of the generic gif path.","Translate/unify the error message with the rest of the codebase (English) for consistency."],"exampleFix":"// before\nlet url = &info.available_qualities.first()\n    .ok_or_else(|| anyhow!(\"Nenhum URL GIF\"))?.url;\n// after\nlet url = &info.available_qualities.first()\n    .ok_or_else(|| anyhow!(\"No GIF URL available (qualities empty)\"))?.url;","handlingStrategy":"validation","validationCode":"if info.media_type == MediaType::Gif && info.available_qualities.is_empty() {\n    return Err(\"media info has no GIF URL; re-fetch or use redgifs extractor\");\n}","typeGuard":"fn has_gif_entry(info: &MediaInfo) -> bool {\n    info.available_qualities.first().map_or(false, |q| !q.url.is_empty())\n}","tryCatchPattern":"match download(url, out).await {\n    Err(e) if e.to_string().contains(\"GIF\") => {\n        let fresh = get_media_info(url).await?;\n        download_fresh(fresh, out).await\n    }\n    other => other,\n}","preventionTips":["Route redgifs/imgur GIF posts to dedicated extractors instead of the generic gif path","Fall back to preview.images[0].variants.mp4.source.url when variants are empty","Keep the error message language consistent (English) for easier matching","Add a parse_media invariant: MediaType::Gif must produce at least one quality entry"],"tags":["reddit","gif","media-parsing","invariant"],"backgroundTag":"internal-invariant-violation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}