{"record":{"id":"324967804225bbc4","repo":"tonhowtf/omniget","slug":"no-media-found-in-post-324967","errorCode":null,"errorMessage":"No media found in post","messagePattern":"No media found in post","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/reddit/mod.rs","lineNumber":421,"sourceCode":"\nimpl RedditDownloader {\n    async fn fallback_ytdlp(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        let ytdlp_path = crate::core::ytdlp::ensure_ytdlp().await?;\n        let json = crate::core::ytdlp::get_video_info(&ytdlp_path, url, &[]).await?;\n        crate::platforms::generic_ytdlp::GenericYtdlpDownloader::parse_video_info(&json)\n    }\n\n    async fn native_get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {\n        let canonical = self.resolve_to_canonical(url).await?;\n\n        let post_id = Self::extract_post_id(&canonical)\n            .ok_or_else(|| anyhow!(\"Could not extract post ID\"))?;\n\n        let subreddit = Self::extract_subreddit(&canonical).unwrap_or_default();\n\n        let data = self.fetch_post_data(&post_id).await?;\n\n        let media = Self::parse_media(&data).ok_or_else(|| anyhow!(\"No media found in post\"))?;\n\n        let source_id = if subreddit.is_empty() {\n            post_id.clone()\n        } else {\n            format!(\"{}_{}\", subreddit.to_lowercase(), post_id)\n        };\n\n        let title = format!(\"reddit_{}\", source_id);\n\n        match media {\n            RedditMedia::Video {\n                video_url,\n                duration,\n            } => {\n                let audio = self.find_audio_url(&video_url).await;\n                let mut qualities = vec![VideoQuality {\n                    label: \"video\".to_string(),\n                    width: 0,","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/reddit/mod.rs#L403-L439","documentation":"After successfully fetching the post JSON, native_get_media_info calls parse_media; if the post data contains no recognizable media (no video, gif, image, or gallery payload) it throws 'No media found in post'. The post exists but is not downloadable content.","triggerScenarios":"Text-only/self posts, link posts to external sites, polls, and comments fetched via post ID; also posts whose media layout changed in Reddit's API (e.g. new gallery or u/redgifs embeds the parser does not cover).","commonSituations":"User pastes a URL to a text post expecting an image; crossposts whose media sits in the crosspost_parent object; NSFW media behind redgifs/erome embeds; Reddit API schema changes for new post types.","solutions":["Check post.is_self / absence of secure_media, is_gallery and preview fields before calling download; tell the user the post has no media.","Extend parse_media to handle crosspost_parent, gallery_data/items, and preview.images fallbacks.","Detect external embeds (redgifs, imgur, erome) in post.url_overridden_by_dest and route them to the right handler.","Log the post JSON on failure to identify unhandled media shapes.","Fail fast without retrying — the result is deterministic for that post."],"exampleFix":"// before\nlet media = Self::parse_media(&data).ok_or_else(|| anyhow!(\"No media found in post\"))?;\n// after\nlet media = Self::parse_media(&data).ok_or_else(|| {\n    let is_self = data.pointer(\"/is_self\").and_then(|v| v.as_bool()).unwrap_or(false);\n    if is_self { anyhow!(\"Post is a text-only post and has no downloadable media\") }\n    else { anyhow!(\"Post media format not supported (see logs for post JSON)\") }\n})?;","handlingStrategy":"type-guard","validationCode":"// inspect the fetched post JSON before treating it as media\nif data.get(\"is_self\").and_then(|v| v.as_bool()).unwrap_or(false)\n    && data.get(\"is_gallery\").is_none()\n    && data.get(\"secure_media\").is_none() {\n    return Err(\"text-only post, nothing to download\");\n}","typeGuard":"fn post_has_media(data: &serde_json::Value) -> bool {\n    [\"secure_media\", \"is_gallery\", \"preview\", \"crosspost_parent_list\", \"url_overridden_by_dest\"]\n        .iter().any(|k| data.get(k).map_or(false, |v| !v.is_null()))\n}","tryCatchPattern":"match get_media_info(url).await {\n    Err(e) if e.to_string().contains(\"No media found in post\") => notify(\"This post contains no downloadable media\"),\n    other => other,\n}","preventionTips":["Check is_self / preview / is_gallery before attempting download","Extend parse_media for crossposts, galleries and external embeds (redgifs, imgur)","Log post JSON on failure to detect Reddit API schema changes","Fail fast — never retry a deterministic no-media result"],"tags":["reddit","media-parsing","unsupported-content"],"backgroundTag":"entity-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"}