tonhowtf/omniget · error

No media found in post

Error message

No media found in post

What it means

After successfully fetching the post JSON, native_get_media_info calls parse_media; if the post data contains no recognizable media (no video, gif, image, or gallery payload) it throws 'No media found in post'. The post exists but is not downloadable content.

Solutions

  1. Check post.is_self / absence of secure_media, is_gallery and preview fields before calling download; tell the user the post has no media.
  2. Extend parse_media to handle crosspost_parent, gallery_data/items, and preview.images fallbacks.
  3. Detect external embeds (redgifs, imgur, erome) in post.url_overridden_by_dest and route them to the right handler.
  4. Log the post JSON on failure to identify unhandled media shapes.
  5. Fail fast without retrying — the result is deterministic for that post.

Example fix

// before
let media = Self::parse_media(&data).ok_or_else(|| anyhow!("No media found in post"))?;
// after
let media = Self::parse_media(&data).ok_or_else(|| {
    let is_self = data.pointer("/is_self").and_then(|v| v.as_bool()).unwrap_or(false);
    if is_self { anyhow!("Post is a text-only post and has no downloadable media") }
    else { anyhow!("Post media format not supported (see logs for post JSON)") }
})?;
Defensive patterns

Strategy: type-guard

Validate before calling

// inspect the fetched post JSON before treating it as media
if data.get("is_self").and_then(|v| v.as_bool()).unwrap_or(false)
    && data.get("is_gallery").is_none()
    && data.get("secure_media").is_none() {
    return Err("text-only post, nothing to download");
}

Type guard

fn post_has_media(data: &serde_json::Value) -> bool {
    ["secure_media", "is_gallery", "preview", "crosspost_parent_list", "url_overridden_by_dest"]
        .iter().any(|k| data.get(k).map_or(false, |v| !v.is_null()))
}

Try / catch

match get_media_info(url).await {
    Err(e) if e.to_string().contains("No media found in post") => notify("This post contains no downloadable media"),
    other => other,
}

Prevention

When it happens

Trigger: Text-only/self posts, link posts to external sites, polls, and comments fetched via post ID; also posts whose media layout changed in Reddit's API (e.g. new gallery or u/redgifs embeds the parser does not cover).

Common situations: User pastes a URL to a text post expecting an image; crossposts whose media sits in the crosspost_parent object; NSFW media behind redgifs/erome embeds; Reddit API schema changes for new post types.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/324967804225bbc4. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/src/platforms/reddit/mod.rs:421

impl RedditDownloader {
    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 canonical = self.resolve_to_canonical(url).await?;

        let post_id = Self::extract_post_id(&canonical)
            .ok_or_else(|| anyhow!("Could not extract post ID"))?;

        let subreddit = Self::extract_subreddit(&canonical).unwrap_or_default();

        let data = self.fetch_post_data(&post_id).await?;

        let media = Self::parse_media(&data).ok_or_else(|| anyhow!("No media found in post"))?;

        let source_id = if subreddit.is_empty() {
            post_id.clone()
        } else {
            format!("{}_{}", subreddit.to_lowercase(), post_id)
        };

        let title = format!("reddit_{}", source_id);

        match media {
            RedditMedia::Video {
                video_url,
                duration,
            } => {
                let audio = self.find_audio_url(&video_url).await;
                let mut qualities = vec![VideoQuality {
                    label: "video".to_string(),
                    width: 0,

View on GitHub (pinned to 8600b91f42)