Morganamilo/paru · error · anyhow::Error

get

Error message

get {}: {}

What it means

search_aur_regex downloads the full AUR package list (packages.gz) and fails if the HTTP response is not a success status, formatting the error as 'get <url>: <status>'. It is a defensive check that the AUR metadata download succeeded before parsing.

Solutions

  1. Check AUR status (status.archlinux.org) and retry later if the AUR is down
  2. Verify aur_url in paru.conf points to https://aur.archlinux.org
  3. Test manually: curl -I <aur_url>/packages.gz to see the actual status; fix proxy/network if it's a gateway error
  4. Check whether a proxy/firewall is intercepting the request

Example fix

// before (paru.conf)
AurUrl = https://aur.example.org
// after
AurUrl = https://aur.archlinux.org
Defensive patterns

Strategy: retry

Validate before calling

// pre-check AUR reachability before searching
curl -fsSI https://aur.archlinux.org/packages.gz >/dev/null && echo "AUR reachable"

Try / catch

match paru_search(targets).await {
    Err(e) if e.to_string().contains("get ") => {
        eprintln!("AUR unavailable ({}), retrying later", e);
    }
    Err(e) => eprintln!("search failed: {}", e),
    Ok(p) => print(p),
}

Prevention

When it happens

Trigger: Calling paru search (regex search path) when the AUR server returns 4xx/5xx for config.aur_url + 'packages.gz' — server outage, maintenance, rate limiting, or a wrong aur_url in config.

Common situations: AUR downtime or CDN errors; corporate proxy returning error pages; aur_url misconfigured to a mirror that no longer serves packages.gz; captive portal networks.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12). Data as JSON: /api/errors/6a54075116bb447e. Report an issue: GitHub.

Appendix: source

Thrown at src/search.rs:174

        if !matches!(pkgs, Err(raur::Error::Aur(_))) {
            break;
        }
    }

    if pkgs.is_ok() {
        targets.remove(index);
    }

    Ok(pkgs?)
}

async fn search_aur_regex(config: &Config, targets: &[String]) -> Result<Vec<raur::Package>> {
    let url = config.aur_url.join("packages.gz")?;
    let resp = get(url.clone())
        .await
        .with_context(|| format!("get {}", url))?;
    let success = resp.status().is_success();
    ensure!(success, "get {}: {}", url, resp.status());

    let data = resp.bytes().await?;
    let decoder = GzDecoder::new(&*data);
    let data =
        std::io::read_to_string(decoder).with_context(|| tr!("failed to decode package list"))?;

    let regex = RegexSet::new(targets)?;

    let pkgs = data
        .lines()
        .filter(|pkg| regex.is_match(pkg))
        .collect::<Vec<_>>();
    ensure!(pkgs.len() < 2000, "too many packages");
    let pkgs = config.raur.info(&pkgs).await?;
    Ok(pkgs)
}

async fn search_aur(config: &Config, targets: &[String]) -> Result<Vec<raur::Package>> {

View on GitHub (pinned to 9ac3578807)