Morganamilo/paru · error

duplicate PKGBUILD

Error message

duplicate PKGBUILD: {}

What it means

aura refuses to proceed when two requested packages share the same PKGBUILD base but come from different repositories (e.g. one from AUR, one from an explicit repo overlay). Since one build directory can only serve one source for a pkgbase, processing both would silently build the wrong package, so pkgbuild_pkgbuilds bails out during getpkgbuilds.

Solutions

  1. Remove one of the conflicting packages from the target list so only one source per pkgbase is requested
  2. Check which repo each duplicate comes from and disambiguate with repo-qualified names if supported
  3. If a stale custom repo provides the duplicate, update or remove that repo entry
  4. If you maintain the AUR package, rename it so its pkgbase no longer collides with the repo package

Example fix

// before
paru -G linux linux
// after (request only one source per pkgbase)
paru -G linux
Defensive patterns

Strategy: validation

Validate before calling

// dedupe targets by pkgbase before requesting
let mut seen = std::collections::HashSet::new();
targets.retain(|t| seen.insert(pkgbase_of(t)));

Prevention

When it happens

Trigger: Calling getpkgbuilds with a target list containing two packages whose srcinfo pkgbase() is identical but whose repo fields differ; the Entry::Occupied branch in the pkgs map detects the repo mismatch and bails.

Common situations: Requesting both a repo package and an AUR package with the same base name (e.g. a renamed or duplicated AUR package shadowing an official one); having a custom repo that provides a package also present in AUR; typos in a package list referencing both variants.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at src/download.rs:291

    for &targ in pkgbuild {
        let Some((base, _)) = config.pkgbuild_repos.target(config, targ) else {
            eprintln!(
                "{} {}",
                color.error.paint("error:"),
                tr!("package '{}' was not found", targ.pkg),
            );
            ret = 1;
            continue;
        };

        match pkgs.entry(base.srcinfo.pkgbase()) {
            Entry::Vacant(v) => {
                v.insert(base);
            }
            Entry::Occupied(o) => {
                if o.get().repo != base.repo {
                    bail!(tr!("duplicate PKGBUILD: {}", base.srcinfo.pkgbase()))
                }
            }
        }
    }

    for (n, pkg) in pkgs.values().enumerate() {
        let path = cwd.join(pkg.srcinfo.pkgbase());
        print_download(config, n + 1, pkgs.len(), pkg.srcinfo.pkgbase());

        if path.exists() {
            if !path.join("PKGBUILD").exists() {
                eprintln!(
                    "{} {}",
                    color.error.paint("error:"),
                    tr!(
                        "package '{}' exists but has no PKGBUILD -- skipping",
                        pkg.srcinfo.pkgbase(),
                    ),

View on GitHub (pinned to 9ac3578807)