tonhowtf/omniget · error

Unsupported media type

Error message

Unsupported media type

What it means

The MediaType match in native_download has no executable arm for the encountered variant, so the catch-all `_ =>` returns this error. It means the post's media type is not one of the supported Photo/Video/Gallery download paths.

Solutions

  1. Check the media type before calling download and reject unsupported kinds up front
  2. Add a match arm for the missing MediaType variant or filter posts to supported types
  3. Improve the error message to include the actual media type for debugging
  4. Update the parser if new Reddit post types should be supported

Example fix

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

Strategy: validation

Validate before calling

match media_type {
    MediaType::Photo | MediaType::Video | MediaType::Gallery => Ok(()),
    other => Err(format!("unsupported media type: {:?}", other)),
}

Try / catch

match download(url).await {
    Err(e) if e.to_string() == "Unsupported media type" => skip_post(url),
    other => other,
}

Prevention

When it happens

Trigger: Calling download on a Reddit post whose MediaType is a variant not handled by native_download (e.g. self-post/text, link, or a newly added media type).

Common situations: Users pasting a URL to a text/self post or external link, or a library update introducing a new Reddit media type not yet handled in the match.

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

Appendix: source

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