tonhowtf/omniget · warning · anyhow::Error

Nenhum redirect encontrado para

Error message

Nenhum redirect encontrado para {}

What it means

resolve_redirect() performs a GET and compares the final response URL (after reqwest followed redirects) with the original. If they are identical, the URL did not redirect anywhere, so there is no 'resolved' URL to return and this error is thrown. It is a semantic failure: the request itself succeeded, but the input was not actually a redirecting URL.

Solutions

  1. Check whether the URL really is a redirector; if it's a direct link, use it as-is instead of resolving
  2. Return the input URL as a fallback instead of failing when no redirect occurred
  3. Increase reqwest redirect policy limits if loops are the cause and inspect the redirect history via response.history()
  4. Handle meta/JS redirects manually by parsing the response body if the target site uses them

Example fix

// before
let final_url = resolve_redirect(&client, &url).await?;
// after
let final_url = match resolve_redirect(&client, &url).await {
    Ok(u) => u,
    Err(_) => url.to_string(), // direct URL — use as-is
};
Defensive patterns

Strategy: fallback

Validate before calling

let resp = client.get(url).send().await?;
if resp.url().as_str() == url {
    eprintln!("URL is direct, no redirect to resolve");
}

Try / catch

let final_url = resolve_redirect(&client, url)
    .await
    .unwrap_or_else(|_| url.to_string());

Prevention

When it happens

Trigger: Calling resolve_redirect() with a direct/static URL that responds 200 at the same URL (no Location-based redirect); a URL using meta-refresh or JS redirect that reqwest cannot follow; a redirect loop that reqwest terminated by returning the same URL.

Common situations: Media sites switching from redirect endpoints to direct URLs; shortener already expanded; spicetify/marketplace links that serve content directly; redirect loops on misconfigured servers.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/redirect.rs:9

use anyhow::anyhow;

pub async fn resolve_redirect(client: &reqwest::Client, url: &str) -> anyhow::Result<String> {
    let response = client.get(url).send().await?;

    let final_url = response.url().to_string();

    if final_url == url {
        return Err(anyhow!("Nenhum redirect encontrado para {}", url));
    }

    Ok(final_url)
}

View on GitHub (pinned to 8600b91f42)