tonhowtf/omniget · error

isto é um sub ou um perfil: cole o link de um post

Error message

isto é um sub ou um perfil: cole o link de um post

What it means

Target-kind guard in reddit download run: the parsed link points at a subreddit or user profile rather than an individual post, and those targets have no single post media to download, so the run refuses and asks for a post link.

Solutions

  1. Navigate into a specific post and use its /comments/<id>/ URL
  2. If you need multiple posts from a sub/user, use the listing/bulk-download tool instead of this one
  3. Strip trailing sub or /user segments and append the post id path

Example fix

// before
url: "https://www.reddit.com/r/rust/"
// after
url: "https://www.reddit.com/r/rust/comments/abc123/title/"
Defensive patterns

Strategy: validation

Validate before calling

fn is_listing_url(url: &str) -> bool {
    let p = url.trim_end_matches('/');
    p.contains("reddit.com/r/") && p.matches('/').count() <= 5
        || p.contains("reddit.com/user/") && p.matches('/').count() <= 5
}
// if is_listing_url(&opts.url) { /* prompt for a specific post */ }

Type guard

fn url_is_single_post(url: &str) -> bool {
    url.contains("reddit.com") && url.contains("/comments/")
}

Prevention

When it happens

Trigger: Passing https://reddit.com/r/<sub> or https://reddit.com/u/<user> (or /user/<name>) URLs to baixa_um_video_de_verdade / baixa_uma_galeria_de_verdade.

Common situations: Copying the URL from a subreddit or profile tab instead of opening a post first; intending bulk download and calling the single-post API by mistake.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

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

    })?;
    if let Target::Short { url } = &target {
        let final_url = fetcher.resolve(url).await?;
        target = parse_target(&final_url)
            .ok_or_else(|| anyhow!("o link curto não levou a um post ({})", final_url))?;
    }

    // Mídia solta e link de fora não têm post para consultar.
    let (post, plan) = match &target {
        Target::Post { id, .. } => {
            let post = fetch_post(&fetcher, id).await?;
            let plan = plan_for(&post);
            (Some(post), plan)
        }
        Target::Media { url, video: true } => (None, Plan::Video { url: url.clone() }),
        Target::Media { url, video: false } => (None, Plan::Image { url: url.clone() }),
        Target::External { url } => (None, Plan::External { url: url.clone() }),
        Target::Subreddit { .. } | Target::User { .. } => {
            return Err(anyhow!(
                "isto é um sub ou um perfil: cole o link de um post"
            ))
        }
        Target::Short { .. } => return Err(anyhow!("não foi possível resolver o link curto")),
    };

    let info = post.as_ref().map(post_info).unwrap_or_else(|| PostInfo {
        id: String::new(),
        title: opts
            .url
            .rsplit('/')
            .find(|s| !s.is_empty())
            .unwrap_or("reddit")
            .split('.')
            .next()
            .unwrap_or("reddit")
            .to_string(),
        ..PostInfo::default()

View on GitHub (pinned to 8600b91f42)