{"record":{"id":"3a8ebd6e8c01a318","repo":"tonhowtf/omniget","slug":"unsupported-media-type-for-download-3a8ebd","errorCode":null,"errorMessage":"Unsupported media type for download","messagePattern":"Unsupported media type for download","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/tiktok/mod.rs","lineNumber":669,"sourceCode":"\n                let bytes = direct_downloader::download_direct_with_headers(\n                    &self.client,\n                    &quality.url,\n                    &output,\n                    progress,\n                    Some(headers),\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            _ => Err(anyhow!(\"Unsupported media type for download\")),\n        }\n    }\n}\n","sourceCodeStart":651,"sourceCodeEnd":673,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/tiktok/mod.rs#L651-L673","documentation":"download() handles MediaType::Video and MediaType::Audio explicitly; any other MediaType variant reaches the catch-all `_ =>` arm and is rejected with this error. It is an internal guard indicating the media type has no download implementation.","triggerScenarios":"Calling download() with a MediaInfo whose media_type is any variant other than Video or Audio (e.g., Image/Gallery if such a variant exists on MediaType) that lacks a dedicated download branch.","commonSituations":"Attempting to download a TikTok photo slideshow/image post through the generic download() entry point; a new MediaType variant added without extending the match in download().","solutions":["Route image/gallery media to the image-specific download path instead of this one.","Check info.media_type before calling download() and use the appropriate downloader.","If a new MediaType variant was added, extend the match in download() with a branch for it.","Reject unsupported media types earlier in the UI/command layer."],"exampleFix":"// before\n_ => Err(anyhow!(\"Unsupported media type for download\")),\n// after\nMediaType::Image => self.download_images(info, opts).await,\n_ => Err(anyhow!(\"Unsupported media type for download: {:?}\", info.media_type)),","handlingStrategy":"type-guard","validationCode":"// Only call download for supported media types\nif !matches!(info.media_type, MediaType::Video | MediaType::Audio) {\n    eprintln!(\"media type not supported by this downloader\");\n}","typeGuard":"fn is_downloadable(mt: &MediaType) -> bool {\n    matches!(mt, MediaType::Video | MediaType::Audio)\n}","tryCatchPattern":"match download(info, opts).await {\n    Err(e) if e.to_string().contains(\"Unsupported media type\") => route_to_image_downloader(info),\n    other => other,\n}","preventionTips":["Match on media_type in the caller and pick the right downloader.","When adding a MediaType variant, extend every match in download paths.","Filter unsupported types out in the UI before offering a download button."],"tags":["tiktok","unsupported-type","download","enum"],"backgroundTag":"unsupported-operation","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}