tonhowtf/omniget · error

Unsupported media type for download

Error message

Unsupported media type for download

What it means

Raised by TiktokDownloader::download when media_type is none of the handled variants (Video, Photo, Carousel, Audio). It is the catch-all arm of the download match, meaning the platform layer cannot route this media kind to any download strategy.

Solutions

  1. Check which MediaType value your MediaInfo carries before routing it to this downloader
  2. Add a handler or explicit fallback for the missing MediaType variant in the match
  3. Route unsupported types to the generic yt-dlp downloader

Example fix

// before
_ => Err(anyhow!("Unsupported media type for download")),
// after
media_type => {
    log::warn!("TikTok downloader got unhandled media type {:?}; falling back to yt-dlp", media_type);
    self.fallback_ytdlp_download(&url, &opts).await
}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: [MediaType; 4] = [MediaType::Video, MediaType::Photo, MediaType::Carousel, MediaType::Audio];
if !SUPPORTED.contains(&info.media_type) { /* route to generic downloader */ }

Type guard

fn is_downloadable_tiktok_type(t: &MediaType) -> bool {
    matches!(t, MediaType::Video | MediaType::Photo | MediaType::Carousel | MediaType::Audio)
}

Try / catch

match downloader.download(&info, &opts).await {
    Err(e) if e.to_string().contains("Unsupported media type") => generic_downloader.download(&url, &opts).await,
    other => other,
}

Prevention

When it happens

Trigger: Calling download() with a MediaInfo whose media_type is an exotic/other MediaType variant not covered by the match in tiktok.rs, e.g. a future variant added to the enum without updating this arm.

Common situations: A MediaType enum was extended (e.g. GIF, Story) but the TikTok downloader was not updated; extraction misclassified a post into a non-downloadable type.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/f233fcc4766cd1cb. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/tiktok.rs:669

                let bytes = direct_downloader::download_direct_with_headers(
                    &self.client,
                    &quality.url,
                    &output,
                    progress,
                    Some(headers),
                    Some(&opts.cancel_token),
                )
                .await?;

                Ok(DownloadResult {
                    file_path: output,
                    file_size_bytes: bytes,
                    duration_seconds: 0.0,
                    torrent_id: None,
                })
            }
            _ => Err(anyhow!("Unsupported media type for download")),
        }
    }
}

View on GitHub (pinned to 8600b91f42)