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

The input was a short link (Target::Short); after fetcher.resolve() followed redirects, parse_target() still could not classify the final URL as a post or media target. The library throws this so the user knows the short link redirected to something unusable (the final URL is included in the message).

Solutions

  1. Open the short link in a browser, copy the full post URL it redirects to, and pass that instead
  2. Verify the post still exists and is not removed/quarantined (consent pages break resolution)
  3. Re-run with a valid session cookie via opts.session_netscape if Reddit is serving a consent/login redirect
  4. If the link truly points to media, paste the direct i.redd.it / v.redd.it URL instead

Example fix

// before
url: "https://redd.it/abc123"  // redirects to removed post
// after
url: "https://www.reddit.com/r/rust/comments/abc123/title/"
Defensive patterns

Strategy: fallback

Validate before calling

// Pre-check short links by following them with an HTTP client:
let resp = reqwest::Client::new().get(&short_url).send().await?;
let final_url = resp.url().to_string();
if !final_url.contains("/comments/") { eprintln!("short link did not lead to a post: {}", final_url); }

Try / catch

match tool.run(opts).await {
    Err(e) if e.to_string().starts_with("o link curto") => {
        // expand the link manually or ask user for the full post URL
    }
    other => other?,
}

Prevention

When it happens

Trigger: A redd.it/<id> or reddit.com/s/<token> style short URL whose redirect lands on a subreddit page, a login/consent page, an external site, or fails to a URL parse_target doesn't recognize.

Common situations: Deleted/removed posts whose short links redirect to the subreddit; region/NSFW consent interstitials; link shorteners wrapping a non-Reddit destination; rate-limit or error pages served to the resolver.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

    let r =
        crate::core::tools::gallery::download(url, &dest.to_string_lossy(), None, progress.clone())
            .await?;
    Ok((r.files, r.log_tail))
}

pub async fn run(opts: &Options, progress: ProgressFn) -> Result<DownloadResult> {
    report(&progress, ID, "started", 0, None, None);
    let dest = PathBuf::from(&opts.dest);
    std::fs::create_dir_all(&dest)?;
    let fetcher = Fetcher::new(opts.delay_ms, opts.session_netscape.as_deref())?;

    let mut target = parse_target(&opts.url).ok_or_else(|| {
        anyhow!("cole o link de um post do Reddit, de um i.redd.it ou de um v.redd.it")
    })?;
    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")),

View on GitHub (pinned to 8600b91f42)