{"record":{"id":"75c39ad455445d4f","repo":"tonhowtf/omniget","slug":"nenhum-url-de-imagem","errorCode":null,"errorMessage":"Nenhum URL de imagem","messagePattern":"Nenhum URL de imagem","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/platforms/reddit.rs","lineNumber":706,"sourceCode":"                    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,\n                })\n            }\n            MediaType::Photo => {\n                let quality = info\n                    .available_qualities\n                    .first()\n                    .ok_or_else(|| anyhow!(\"Nenhum URL de imagem\"))?;\n                let ext = &quality.format;\n                let output = opts.output_dir.join(format!(\n                    \"{}.{}\",\n                    sanitize_filename::sanitize(&info.title),\n                    ext\n                ));\n                let bytes = direct_downloader::download_direct(\n                    &self.client,\n                    &quality.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,","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/platforms/reddit.rs#L688-L724","documentation":"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.","triggerScenarios":"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.","commonSituations":"Gallery posts where only some items parse, removed images (Reddit returns placeholder 'removed' previews), or external image hosts blocking the fetch.","solutions":["Inspect the post JSON's preview / gallery_data / media_metadata fields to see what parse_media missed.","Extend parse_media to enumerate all gallery items and produce a quality entry for each.","Re-fetch media info and retry in case the earlier response was truncated.","Handle empty qualities as 'image unavailable' in the UI instead of a raw error."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"// before download, ensure an image URL exists\nfn has_image_entry(info: &MediaInfo) -> bool {\n    info.media_type == MediaType::Photo\n        && info.available_qualities.first().map(|q| !q.url.is_empty()).unwrap_or(false)\n}","typeGuard":"fn image_quality(info: &MediaInfo) -> Option<&Quality> {\n    if info.media_type != MediaType::Photo { return None; }\n    info.available_qualities.first().filter(|q| !q.url.is_empty())\n}","tryCatchPattern":"match native_download(opts).await {\n    Err(e) if e.to_string() == \"Nenhum URL de imagem\" => {\n        show_user(\"Image source unavailable (removed or unsupported host)\");\n    }\n    other => other,\n}","preventionTips":["Verify preview/gallery_data/media_metadata fields exist before classifying as Photo.","Enumerate all gallery items in parse_media so multi-image posts always yield entries.","Detect Reddit 'removed' placeholder previews and skip such posts.","Re-fetch media info and retry once when qualities come back empty."],"tags":["reddit","image","download","media"],"backgroundTag":"resource-not-found","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"}