tonhowtf/omniget · error · anyhow::Error

Unsupported media type for download

Error message

Unsupported media type for download

What it means

The Bluesky `download` implementation only handles a fixed set of `MediaType` variants (e.g. Image, Video, Gif); the catch-all `_` arm rejects any other media type. It signals that the requested media kind has no download path implemented for this platform.

Solutions

  1. Check which MediaType is being passed and add a download implementation for that variant.
  2. Filter unsupported media types out before calling download so only supported kinds reach it.
  3. Update the match to handle newly added MediaType variants instead of falling into `_`.
  4. Improve the error message to include the actual media type for easier triage.

Example fix

// before
_ => Err(anyhow!("Unsupported media type for download")),
// after
other => Err(anyhow!("Unsupported media type for download: {:?}", other)),
Defensive patterns

Strategy: validation

Validate before calling

// Rust, before calling download
const SUPPORTED: &[MediaType] = &[MediaType::Image, MediaType::Video, MediaType::Gif];
if !SUPPORTED.contains(&info.media_type) {
    // skip or route to another platform handler
}

Prevention

When it happens

Trigger: Calling `download` on Bluesky MediaInfo whose `media_type` matches none of the handled arms — for instance unsupported/unknown media types returned by the API or new enum variants added without updating this match.

Common situations: New Bluesky media kinds (e.g. external embeds, polls, audio) appearing in the API, an enum variant added in a refactor that left the trailing `_ => Err(...)` in place, or mixed-embed posts where the resolved type is not a downloadable one.

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

Appendix: source

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

                let output = opts.output_dir.join(&filename);

                let bytes = direct_downloader::download_direct(
                    &self.client,
                    gif_url,
                    &output,
                    progress,
                    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)