{"record":{"id":"f2b7d6edc8aeb677","repo":"tonhowtf/omniget","slug":"unsupported-media-type-mod","errorCode":null,"errorMessage":"Unsupported media type","messagePattern":"Unsupported media type","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/bluesky/mod.rs","lineNumber":41,"sourceCode":"\nimpl BlueskyDownloader {\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 (user, post_id) = Self::extract_user_and_post(url)\n            .ok_or_else(|| anyhow!(\"Could not extract user and post_id from URL\"))?;\n\n        let json = self.fetch_post(&user, &post_id).await?;\n\n        let embed = json\n            .pointer(\"/thread/post/embed\")\n            .ok_or_else(|| anyhow!(\"Post does not contain media\"))?;\n\n        let media = extract_media(embed).ok_or_else(|| anyhow!(\"Unsupported media type\"))?;\n\n        let filename_base = format!(\"bluesky_{}_{}\", sanitize_filename::sanitize(&user), post_id);\n\n        match media {\n            BlueskyMedia::Video { hls_url } => Ok(MediaInfo {\n                title: filename_base,\n                author: user,\n                platform: \"bluesky\".to_string(),\n                duration_seconds: None,\n                thumbnail_url: None,\n                available_qualities: vec![VideoQuality {\n                    label: \"best\".to_string(),\n                    width: 0,\n                    height: 0,\n                    url: hls_url,\n                    format: \"hls\".to_string(),\n                }],\n                media_type: MediaType::Video,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/bluesky/mod.rs#L23-L59","documentation":"In `native_get_media_info` (src-tauri/src/platforms/bluesky/mod.rs:41), the post had an embed but `extract_media(embed)` returned None because the embed type is one the downloader does not handle (e.g. `record` quote embeds, `external` link cards, or multi-view embeds without a direct media variant). Only image and video embeds are recognized.","triggerScenarios":"The post's `embed.$type` is not `app.bsky.embed.images` or `app.bsky.embed.video` — for instance a quoted-post embed, an external website card, or `recordWithMedia` whose inner structure extract_media doesn't unwrap.","commonSituations":"Trying to download a quote post where the media belongs to the quoted record; posts linking to an external video host; new Bluesky embed types introduced after this code was written.","solutions":["Only use this downloader on posts with native images or video attached.","Extend `extract_media` to unwrap `app.bsky.embed.recordWithMedia` and recurse into quoted records.","Log `embed.$type` in the error message to make unsupported types diagnosable.","Fall back to the ytdlp generic path which may support the embed type."],"exampleFix":"// before\nlet media = extract_media(embed).ok_or_else(|| anyhow!(\"Unsupported media type\"))?;\n// after\nlet media = extract_media(embed).ok_or_else(|| anyhow!(\n    \"Unsupported media type: {}\",\n    embed.get(\"$type\").and_then(|t| t.as_str()).unwrap_or(\"unknown\")\n))?;","handlingStrategy":"validation","validationCode":"const SUPPORTED: [&str; 2] = [\"app.bsky.embed.images\", \"app.bsky.embed.video\"];\nfn embed_supported(embed: &serde_json::Value) -> bool {\n    embed.get(\"$type\").and_then(|t| t.as_str())\n        .map(|t| SUPPORTED.contains(&t))\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check embed.$type before attempting extraction.","Keep extract_media updated with new Bluesky embed types.","Route unsupported embeds to a fallback downloader instead of failing."],"tags":["rust","bluesky","unsupported-embed","media-extraction"],"backgroundTag":"unsupported-operation","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"}