tonhowtf/omniget · error

não foi possível resolver o link curto

Error message

não foi possível resolver o link curto

What it means

Defensive branch: the URL was still Target::Short at plan selection, meaning the earlier resolve/re-parse left an un-resolved short target in scope. The library treats this as an unreachable-but-possible state and throws rather than guessing a target.

Solutions

  1. Pass the fully expanded post URL directly instead of a short link
  2. If persistent, inspect fetcher.resolve() behavior for redirect loops between short-link forms
  3. Update to a version where short-link resolution is fixed if you rely on redd.it links
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = run(opts).await {
    if e.to_string().contains("não foi possível resolver o link curto") {
        // expand short link externally and retry with the full URL
    }
}

Prevention

When it happens

Trigger: Only reachable if a Target::Short survives the resolution step in run() (e.g. the resolve path re-introduced a Short target from the final URL), or in tests exercising the match arm directly.

Common situations: Rare; typically indicates the resolver returned a final URL that parse_target again classified as a short link (redirect chains between short-link forms).

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

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

            .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()
    });
    let base = base_name(&info);

    let (kind, source, mut files, log_tail) = match &plan {

View on GitHub (pinned to 8600b91f42)