tonhowtf/omniget · error · anyhow::Error

Unsupported media type

Error message

Unsupported media type

What it means

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.

Solutions

  1. Only use this downloader on posts with native images or video attached.
  2. Extend `extract_media` to unwrap `app.bsky.embed.recordWithMedia` and recurse into quoted records.
  3. Log `embed.$type` in the error message to make unsupported types diagnosable.
  4. Fall back to the ytdlp generic path which may support the embed type.

Example fix

// before
let media = extract_media(embed).ok_or_else(|| anyhow!("Unsupported media type"))?;
// after
let media = extract_media(embed).ok_or_else(|| anyhow!(
    "Unsupported media type: {}",
    embed.get("$type").and_then(|t| t.as_str()).unwrap_or("unknown")
))?;
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED: [&str; 2] = ["app.bsky.embed.images", "app.bsky.embed.video"];
fn embed_supported(embed: &serde_json::Value) -> bool {
    embed.get("$type").and_then(|t| t.as_str())
        .map(|t| SUPPORTED.contains(&t))
        .unwrap_or(false)
}

Prevention

When it happens

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

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

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

Appendix: source

Thrown at src-tauri/src/platforms/bluesky/mod.rs:41

impl BlueskyDownloader {
    async fn fallback_ytdlp(&self, url: &str) -> anyhow::Result<MediaInfo> {
        let ytdlp_path = crate::core::ytdlp::ensure_ytdlp().await?;
        let json = crate::core::ytdlp::get_video_info(&ytdlp_path, url, &[]).await?;
        crate::platforms::generic_ytdlp::GenericYtdlpDownloader::parse_video_info(&json)
    }

    async fn native_get_media_info(&self, url: &str) -> anyhow::Result<MediaInfo> {
        let (user, post_id) = Self::extract_user_and_post(url)
            .ok_or_else(|| anyhow!("Could not extract user and post_id from URL"))?;

        let json = self.fetch_post(&user, &post_id).await?;

        let embed = json
            .pointer("/thread/post/embed")
            .ok_or_else(|| anyhow!("Post does not contain media"))?;

        let media = extract_media(embed).ok_or_else(|| anyhow!("Unsupported media type"))?;

        let filename_base = format!("bluesky_{}_{}", sanitize_filename::sanitize(&user), post_id);

        match media {
            BlueskyMedia::Video { hls_url } => Ok(MediaInfo {
                title: filename_base,
                author: user,
                platform: "bluesky".to_string(),
                duration_seconds: None,
                thumbnail_url: None,
                available_qualities: vec![VideoQuality {
                    label: "best".to_string(),
                    width: 0,
                    height: 0,
                    url: hls_url,
                    format: "hls".to_string(),
                }],
                media_type: MediaType::Video,

View on GitHub (pinned to 8600b91f42)