Morganamilo/paru · error · anyhow::Error

too many packages

Error message

too many packages

What it means

After filtering the AUR package list by regex set, search_aur_regex asserts that fewer than 2000 packages matched before querying raur for their info. More than 2000 matches would create an enormous info request, so it is rejected with 'too many packages'.

Solutions

  1. Use a more specific search term to reduce matches below 2000
  2. Quote regex special characters or escape them in your pattern
  3. Use a non-regex simple search or narrow by category/version if available

Example fix

// before
paru -Ss 'k'
// after
paru -Ss 'kdeconnect'
Defensive patterns

Strategy: validation

Validate before calling

// rough client-side guard: avoid overly broad search terms
if pattern.chars().count() < 3 && !pattern.contains('*') {
    eprintln!("search term too broad, may exceed 2000 matches");
}

Prevention

When it happens

Trigger: A search pattern (or empty/overly-broad regex) that matches ≥2000 names in the AUR packages list, e.g. paru -Ss 'a' or a regex like '.*' routed through search_aur_regex.

Common situations: Searching a single common character or short substring; regex metacharacter typos making the pattern match everything.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at src/search.rs:187

    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>> {
    if targets.is_empty() || !config.mode.aur() {
        return Ok(Vec::new());
    }

    let mut matches = if config.args.has_arg("x", "regex") {
        search_aur_regex(config, targets).await?
    } else {
        let mut targets = targets.iter().map(|t| t.to_lowercase()).collect::<Vec<_>>();
        targets.sort_by_key(|t| t.len());

        let mut matches = Vec::new();

        let by = config.search_by;

View on GitHub (pinned to 9ac3578807)