tonhowtf/omniget · error
Unsupported media type
Error message
Unsupported media type
What it means
native_download in reddit.rs terminates its match on the media type with a catch-all `_ =>` arm that returns this anyhow error. It means the reddit media item resolved to a type the downloader does not implement (neither direct file, HLS/DASH stream, nor torrent path handled above). The library throws it when a post contains an unsupported media kind, so it refuses to download rather than produce a corrupt file.
Solutions
- Check which media type the post resolved to and add a handler for it in native_download's match
- Verify the URL is a supported Reddit post type (video/image, not gallery/poll/live)
- Update the library to a newer version that may support this media type
- Handle the error in the caller and surface a 'post type not supported' message instead of retrying
Example fix
// before
_ => Err(anyhow!("Unsupported media type")),
// after
Some(MediaType::Gallery) => Err(anyhow!("Reddit galleries are not supported yet; download items individually")),
_ => Err(anyhow!("Unsupported media type: {:?}", media.media_type)), Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED_MEDIA_TYPES = ["video", "image", "hls", "torrent"];
if (!SUPPORTED_MEDIA_TYPES.includes(String(post.media_type))) {
throw new Error(`Reddit media type '${post.media_type}' is not supported for download`);
} Type guard
function isDownloadableRedditMedia(m) {
return m != null && ["video", "image", "hls", "torrent"].includes(String(m.media_type));
} Try / catch
match platform.download(url).await {
Err(e) if e.to_string().contains("Unsupported media type") => warn_user("This Reddit post type is not supported"),
other => other?,
} Prevention
- Filter URLs by supported Reddit post kinds before dispatching to download
- Log the resolved media type alongside the error for diagnosis
- Keep the match arm list in sync with Reddit API media variants
- Check the library changelog for newly supported media types
When it happens
Trigger: Calling download on a Reddit post whose resolved media type falls into the default match arm — e.g. a gallery, live post, poll, crosspost, or a new embed type not covered by the handled variants.
Common situations: Reddit introduces/renames a media type in its API; users submit gallery or live-stream URLs; the platform handler's URL pattern matched but the inner media kind was never supported.
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
- Unsupported media type for download
- No resolution available
- Download cancelled
- No video URL
- Nenhum URL GIF
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/cf2f8a8ada9b4e9d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/platforms/reddit.rs:767
Some(&opts.cancel_token),
)
.await?;
total_bytes += bytes;
last_path = output;
let percent = ((i + 1) as f64 / count as f64) * 100.0;
let _ = progress.send(ProgressUpdate::percent(percent)).await;
}
Ok(DownloadResult {
file_path: last_path,
file_size_bytes: total_bytes,
duration_seconds: 0.0,
torrent_id: None,
})
}
_ => Err(anyhow!("Unsupported media type")),
}
}
}
View on GitHub (pinned to 8600b91f42)