tonhowtf/omniget · error · anyhow::Error

Unsupported media type for download

Error message

Unsupported media type for download

What it means

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.

Solutions

  1. Route image/gallery media to the image-specific download path instead of this one.
  2. Check info.media_type before calling download() and use the appropriate downloader.
  3. If a new MediaType variant was added, extend the match in download() with a branch for it.
  4. Reject unsupported media types earlier in the UI/command layer.

Example fix

// before
_ => Err(anyhow!("Unsupported media type for download")),
// after
MediaType::Image => self.download_images(info, opts).await,
_ => Err(anyhow!("Unsupported media type for download: {:?}", info.media_type)),
Defensive patterns

Strategy: type-guard

Validate before calling

// Only call download for supported media types
if !matches!(info.media_type, MediaType::Video | MediaType::Audio) {
    eprintln!("media type not supported by this downloader");
}

Type guard

fn is_downloadable(mt: &MediaType) -> bool {
    matches!(mt, MediaType::Video | MediaType::Audio)
}

Try / catch

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

Prevention

When it happens

Trigger: 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.

Common situations: 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().

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/3a8ebd6e8c01a318. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/tiktok/mod.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)