Morganamilo/paru · error · anyhow::Error

get

Error message

get {}: {}

What it means

save_aur_list fetches the AUR package list (packages.gz) from the configured AUR URL. Two sites produce "get {url}: {detail}": the reqwest GET fails (context from the transport error) or the response status is not a success (ensure! with the status code). Either way the AUR list cache cannot be saved.

Solutions

  1. Retry later — AUR outages are the most common cause; check https://status.archlinux.org.
  2. Test connectivity: `curl -I https://aur.archlinux.org/packages.gz` and fix DNS/proxy if it fails.
  3. Set a proxy for paru if behind a corporate network (https_proxy env var).
  4. Verify the AurUrl option in paru.conf points to a valid AUR RPC/mirror endpoint.

Example fix

# diagnose
curl -I https://aur.archlinux.org/packages.gz
# if behind proxy, before running paru
export https_proxy=http://proxy.corp:8080
paru -Syu
Defensive patterns

Strategy: retry

Validate before calling

let url = "https://aur.archlinux.org/packages.gz";
let reachable = reqwest::get(url).await.map(|r| r.status().is_success()).unwrap_or(false);
assert!(reachable, "AUR unreachable, abort before cache update");

Try / catch

// retry with backoff around the AUR list fetch
for attempt in 0..3 {
    match save_aur_list(&aur_url, &cache_dir).await {
        Ok(()) => break,
        Err(e) if attempt < 2 => tokio::time::sleep(Duration::from_secs(10 << attempt)).await,
        Err(e) => eprintln!("AUR list fetch failed: {e:#}"),
    }
}

Prevention

When it happens

Trigger: Calling update_aur_cache → save_aur_list when the AUR server is unreachable, DNS fails, TLS fails, or the server returns a non-2xx status (5xx, 404, rate limit) for packages.gz.

Common situations: AUR outage or maintenance; DNS resolution failure behind captive portals/VPNs; proxy or firewall blocking aur.archlinux.org; stale/misconfigured AurUrl pointing at a dead mirror.

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/a9f5bdf994bde591. Report an issue: GitHub.

Appendix: source

Thrown at src/completion.rs:21

use std::fs::{create_dir_all, metadata, remove_file, OpenOptions};
use std::io::{stdout, BufRead, BufReader, Read, Write};
use std::path::Path;
use std::time::{Duration, SystemTime};

use anyhow::{ensure, Context, Result};
use flate2::read::GzDecoder;
use reqwest::get;
use tr::tr;
use url::Url;

async fn save_aur_list(aur_url: &Url, cache_dir: &Path) -> Result<()> {
    let url = 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"))?;

    create_dir_all(cache_dir)?;
    let path = cache_dir.join("packages.aur");
    let file = OpenOptions::new()
        .write(true)
        .create(true)
        .truncate(true)
        .open(&path);
    let mut file = file.with_context(|| tr!("failed to open cache file '{}'", path.display()))?;

    for line in data.lines().filter(|l| !l.is_empty()) {
        file.write_all(line.as_bytes())?;
        file.write_all(b"\n")?;

View on GitHub (pinned to 9ac3578807)