{"record":{"id":"8d5100c99bff1d67","repo":"tonhowtf/omniget","slug":"no-media-found-in-post-reddit","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/omniget-core/src/platforms/reddit.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/omniget-core/src/platforms/reddit.rs#L403-L439","documentation":"The post data was fetched successfully, but parse_media returned None — the post's JSON contains no recognized media (no reddit_video, no crosspost_parent video, no gallery, no image preview). native_get_media_info treats media-less posts as an error.","triggerScenarios":"fetch_post_data succeeds but the post is a text post, link post, poll, or has only embedded third-party media that parse_media does not recognize.","commonSituations":"Users paste URLs to text/self posts, external-link posts, or polls; crossposts where parse_media doesn't traverse crosspost_parent; new Reddit media types added after this code was written.","solutions":["Check the post in a browser — if it is a text/link/poll post, there is nothing to download; inform the user.","Inspect the post JSON's media, secure_media, is_gallery and crosspost_parent fields to see what parse_media missed.","Extend parse_media to handle crosspost_parent media extraction if crossposts fail.","Handle this as a 'no downloadable media' result rather than a hard error in the UI."],"exampleFix":"// before\nlet media = Self::parse_media(&data).ok_or_else(|| anyhow!(\"No media found in post\"))?;\n// after: try crossposts before failing\nlet media = Self::parse_media(&data)\n    .or_else(|| Self::parse_crosspost_media(&data))\n    .ok_or_else(|| anyhow!(\"No media found in post\"))?;","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"fn has_downloadable_media(post_json: &serde_json::Value) -> bool {\n    let p = post_json.pointer(\"/data/children/0/data\");\n    p.map(|d| {\n        d.get(\"media\").map(|m| !m.is_null()).unwrap_or(false)\n            || d.get(\"is_gallery\").and_then(|g| g.as_bool()).unwrap_or(false)\n            || d.get(\"crosspost_parent_list\").map(|c| !c.as_array().map_or(true, |a| a.is_empty())).unwrap_or(false)\n    }).unwrap_or(false)\n}","tryCatchPattern":"match native_get_media_info(url).await {\n    Err(e) if e.to_string() == \"No media found in post\" => {\n        show_user(\"This post contains no downloadable media (text/link post?)\");\n    }\n    other => other,\n}","preventionTips":["Check the post type in a browser before attempting downloads (text/link/poll posts have no media).","Guard calls with a media-presence check on the post JSON (media, is_gallery, crosspost_parent_list).","Keep parse_media updated for new Reddit media types and crosspost structures.","Surface 'no media' as an informational result, not a hard failure."],"tags":["reddit","parsing","media","unsupported-content"],"backgroundTag":"unexpected-response-shape","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"}