tonhowtf/omniget · error

este post não tem mídia para baixar (é só texto)

Error message

este post não tem mídia para baixar (é só texto)

What it means

After executing the plan (video/image/gallery/text), the files vector is empty, meaning nothing was downloaded. Since the only plan that legitimately yields nothing is Plan::TextOnly, the library reports that the post is a text-only post with no downloadable media.

Solutions

  1. Check the post in a browser — if it has no image/video, this tool cannot download anything (expected behavior)
  2. For text-only posts use the text-export path instead of media download
  3. If the post does have media, verify the direct downloads aren't failing (look for earlier errors); media may have been removed
  4. Try the gallery-dl fallback manually for crossposts/removed media
Defensive patterns

Strategy: validation

Validate before calling

// Check the post actually has media via Reddit JSON before calling:
let j: serde_json::Value = fetch_json(&post_url).await?;
let has_media = j["data"]["children"][0]["data"]["post_hint"].is_string()
    || !j["data"]["children"][0]["data"]["gallery_data"].is_null();
if !has_media { eprintln!("post is text-only; skipping download"); }

Type guard

fn post_has_media(post: &serde_json::Value) -> bool {
    post["post_hint"].is_string() || !post["gallery_data"].is_null()
        || !post["secure_media"].is_null() || !post["is_gallery"].as_bool().unwrap_or(false)
}

Try / catch

match run(opts).await {
    Err(e) if e.to_string().contains("não tem mídia") => {
        // treat as success-with-nothing-to-do for text-only posts
    }
    other => other?,
}

Prevention

When it happens

Trigger: run() given a self-text post (no media attachment), so the .txt info file was written but files ended up empty — actually thrown when even the text plan did not run, i.e. plans produced zero files.

Common situations: Text-only posts passed to a media downloader; posts where media was removed so all downloads silently failed; crossposts whose media lives on the original post.

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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/download.rs:623

        Plan::TextOnly => ("text", "nenhum", Vec::new(), String::new()),
    };

    if opts.write_info && post.is_some() {
        let want_json = opts.info_format != "txt";
        let want_txt = opts.info_format == "txt" || opts.info_format == "both";
        if want_json {
            let path = dest.join(format!("{}.json", base));
            std::fs::write(&path, serde_json::to_string_pretty(&info)?)?;
            files.push(path.to_string_lossy().to_string());
        }
        if want_txt {
            let path = dest.join(format!("{}.txt", base));
            std::fs::write(&path, info_txt(&info))?;
            files.push(path.to_string_lossy().to_string());
        }
    }
    if files.is_empty() {
        return Err(anyhow!("este post não tem mídia para baixar (é só texto)"));
    }
    report(
        &progress,
        ID,
        "done",
        files.len() as u64,
        Some(files.len() as u64),
        None,
    );
    Ok(DownloadResult {
        kind: kind.to_string(),
        source: source.to_string(),
        files,
        dest: dest.to_string_lossy().to_string(),
        info,
        log_tail,
        used_session: fetcher.has_session(),
    })

View on GitHub (pinned to 8600b91f42)