tonhowtf/omniget · error

No media found in Threads post

Error message

No media found in Threads post

What it means

extract_media_from_post in threads.rs parsed the post's bootstrap JSON successfully but found no image or video entries inside it. The library throws this when the post data exists yet carries no downloadable media, so it cannot build a MediaInfo with items.

Solutions

  1. Confirm the post actually contains an image or video in the app/browser
  2. Check extract_media_from_post's JSON key paths against the current Threads post schema
  3. Skip text-only posts upstream with a friendly 'no media in this post' message
  4. Log the raw post JSON when this fires to catch schema drift early

Example fix

// before
Err(anyhow!("No media found in Threads post"))
// after
Err(anyhow!("No media found in Threads post (is_video-items: {})", media_count))
Defensive patterns

Strategy: validation

Validate before calling

if (!postHasMedia(postJson)) {
  throw new Error("This Threads post contains no image or video");
}

Type guard

function hasMedia(post) {
  return Array.isArray(post?.media) && post.media.length > 0;
}

Try / catch

match threads.get_media_info(url).await {
    Err(e) if e.to_string().contains("No media found") => inform_user("Text-only Threads post"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling get_media_info on a Threads post whose parsed JSON has an empty/absent media array — text-only posts, reposts without media, or posts whose media layout the extractor does not recognize.

Common situations: Users pasting links to text-only Threads posts expecting media; carousel posts where the extractor's media key path changed; images served in a variant shape the single-item extractor returns None for.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/platforms/threads.rs:253

                }

                if !items.is_empty() {
                    return Ok(ThreadsMedia::Carousel { items });
                }
            }
        }

        // Media singolo
        if let Some(item) = Self::extract_single_media(post)? {
            return Ok(ThreadsMedia::Single {
                url: item.url,
                is_video: item.is_video,
                width: item.width,
                height: item.height,
            });
        }

        Err(anyhow!("No media found in Threads post"))
    }

    /// Estrae un singolo elemento media (video o immagine)
    fn extract_single_media(media: &serde_json::Value) -> anyhow::Result<Option<CarouselItem>> {
        // Le dimensioni stanno sul post, non sulle singole versioni
        let original_width = media
            .get("original_width")
            .and_then(|w| w.as_u64())
            .unwrap_or(0) as u32;
        let original_height = media
            .get("original_height")
            .and_then(|h| h.as_u64())
            .unwrap_or(0) as u32;

        // Video: video_versions ha entries {type, url}; type più basso = qualità migliore
        if let Some(video_versions) = media.get("video_versions").and_then(|v| v.as_array()) {
            if !video_versions.is_empty() {
                if let Some(url) = video_versions

View on GitHub (pinned to 8600b91f42)