tonhowtf/omniget · error

isto não é um post: cole o link de uma thread (com…

Error message

isto não é um post: cole o link de uma thread (com /comments/ no meio)

What it means

After optional short-link resolution, resolve_post() matches the parsed Target. Only Target::Post is accepted; any other recognized Reddit target (subreddit, user, etc.) hits the wildcard arm and raises this error telling the user to supply a thread link containing /comments/.

Solutions

  1. Provide the post permalink containing /comments/ in the path
  2. Remove any /comment/<id> suffix and use the parent post URL
  3. Use the raw post id instead of a subreddit or user link
  4. If the URL is a short link, confirm it redirects to a /comments/ URL, not a subreddit

Example fix

// before
resolve_post(&fetcher, "https://www.reddit.com/r/rust/").await?; // subreddit -> error
// after
resolve_post(&fetcher, "https://www.reddit.com/r/rust/comments/1abcxyz/title/").await?
Defensive patterns

Strategy: validation

Validate before calling

fn looks_like_thread_url(u: &str) -> bool {
    u.contains("reddit.com") && u.contains("/comments/")
}
if !looks_like_thread_url(input) && !(input.len() >= 5 && !input.contains('/')) {
    eprintln!("input is not a thread link; expected /comments/ URL or post id");
}

Type guard

fn is_post_input(s: &str) -> bool {
    s.contains("/comments/") || s.starts_with("https://redd.it/") || (s.len() <= 10 && !s.contains('/'))
}

Try / catch

match resolve_post(&fetcher, input).await {
    Ok((id, sub)) => download(id, sub).await,
    Err(e) if e.to_string().contains("nao e um post") => {
        eprintln!("{} is not a thread; need a /comments/ URL", input);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling resolve_post (via run) with a URL/id that parses to a non-post Reddit target — e.g. a subreddit link (r/example), a user page, a comment permalink, or a gallery/collection link.

Common situations: Users paste a subreddit or user URL when asked for a thread; they paste a link to a comment rather than the post; they paste a crosspost or gallery landing page that parse_target classifies as something other than Post.

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/15e2ae61c69412a6. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/thread.rs:808

    pub missing: usize,
    pub requests: u32,
    pub files: Vec<String>,
    pub dest: String,
    /// Se o arquivamento saiu com a sessão do usuário ou anônimo.
    pub used_session: bool,
}

async fn resolve_post(fetcher: &Fetcher, url: &str) -> Result<(String, Option<String>)> {
    let mut target = super::parse_target(url)
        .ok_or_else(|| anyhow!("cole o link de um post do Reddit (ou o id dele)"))?;
    if let Target::Short { url } = &target {
        let final_url = fetcher.resolve(url).await?;
        target = super::parse_target(&final_url)
            .ok_or_else(|| anyhow!("o link curto não levou a um post ({})", final_url))?;
    }
    match target {
        Target::Post { id, subreddit, .. } => Ok((id, subreddit)),
        _ => Err(anyhow!(
            "isto não é um post: cole o link de uma thread (com /comments/ no meio)"
        )),
    }
}

/// Abre os "carregar mais" até o teto de requisições. Devolve quantos
/// comentários ficaram de fora.
async fn expand(
    fetcher: &Fetcher,
    post_id: &str,
    sort: &str,
    mut mores: Vec<MoreRef>,
    flat: &mut Vec<Comment>,
    budget: u32,
    progress: &ProgressFn,
) -> usize {
    let mut missing = 0usize;
    let mut used = 0u32;

View on GitHub (pinned to 8600b91f42)