tonhowtf/omniget · error

o link curto não levou a um post ({})

Error message

o link curto não levou a um post ({})

What it means

resolve_post() in the Reddit thread tool accepts a post URL/id and, if it detects a Reddit short link (Target::Short, e.g. redd.it/xxxx), resolves it via HTTP redirect to the final URL and re-parses. This error is thrown when the redirect target, after re-parsing, still does not yield any recognized Reddit target (post, subreddit, user, etc.) — parse_target returned None for the final URL.

Solutions

  1. Ask the user to paste the full permalink containing /comments/ instead of the short link
  2. Check that the short link actually resolves in a browser (post not removed/deleted)
  3. If you have the post id (base36 after the short domain), pass the raw id instead of the short URL
  4. Retry later if Reddit is returning an error/consent interstitial instead of the redirect

Example fix

// before
resolve_post(&fetcher, "https://redd.it/1abcxyz").await?;
// after
// verify it resolves, or use the canonical form
resolve_post(&fetcher, "https://www.reddit.com/r/someSub/comments/1abcxyz/post_title/").await?
Defensive patterns

Strategy: validation

Validate before calling

// resolve the short link yourself and check it looks like a post permalink
let final_url = reqwest::get(short_url).await?.url().to_string();
if !final_url.contains("/comments/") {
    eprintln!("short link does not lead to a post: {}", final_url);
}

Type guard

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

Try / catch

match resolve_post(&fetcher, input).await {
    Ok((id, sub)) => download(id, sub).await,
    Err(e) if e.to_string().contains("link curto") => {
        eprintln!("short link dead; ask user for the /comments/ permalink");
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling resolve_post (via run) with a short link (redd.it or share link) whose redirect does not land on a parseable Reddit post URL — e.g. the short id points to a removed post, a non-post resource, or fetcher.resolve returned an intermediate/aggregate URL that parse_target cannot classify.

Common situations: Users paste shortened share links from the Reddit mobile app for posts that were deleted/removed; expired or malformed share links redirect to a generic Reddit page; network middleware (login walls, consent pages) intercepts the redirect.

Understand the failure class

Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

    pub subreddit: String,
    pub author: String,
    pub permalink: String,
    pub comments: usize,
    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,

View on GitHub (pinned to 8600b91f42)