jdx/mise · error

AUR packages cannot be built as root; run mise as a…

Error message

AUR packages cannot be built as root; run mise as a non-root user

What it means

AUR packages must be built by a non-root user (makepkg refuses to run as root, and building as root is unsafe). The AUR manager's install checks is_root() and refuses to proceed, directing the user to run mise as a non-root user.

Solutions

  1. Run mise as a regular non-root user
  2. Create a dedicated build user and give it sudo access so ensure_elevation_available can escalate helper commands
  3. In containers, switch to an unprivileged USER before running mise
  4. If root operation is unavoidable, manage Arch packages with pacman instead of the AUR manager

Example fix

// before
$ sudo mise run bootstrap   # root -> error
// after
$ mise run bootstrap        # as normal user; helper elevates itself
Defensive patterns

Strategy: validation

Validate before calling

if unsafe { libc::geteuid() } == 0 && uses_aur_manager {
    eprintln!("re-run as a non-root user; AUR builds refuse root");
    std::process::exit(1);
}

Prevention

When it happens

Trigger: Running mise (or a mise upgrade that triggers AUR install) as uid 0 with opts.dry_run == false on a system using the AUR bootstrap package manager.

Common situations: Running inside a container or VM shell defaulted to root; sudo su / sudo -s leaving the user at a root prompt before invoking mise; CI images that run everything as root.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/38de5d60ba30be4c. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/aur.rs:194

    }

    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        if let Some(pkg) = pkgs.iter().find(|pkg| pkg.version.is_some()) {
            bail!("AUR helpers cannot install a pinned version ('{pkg}')");
        }
        let helper = self
            .helper()
            .ok_or_else(|| eyre::eyre!(self.unavailable_reason()))?;
        let args = install_args(pkgs, opts);
        let command = std::iter::once(helper.to_string())
            .chain(args.iter().cloned())
            .collect::<Vec<_>>();
        if opts.dry_run {
            miseprintln!("{}", shell_words::join(command));
            return Ok(());
        }
        if crate::system::sudo::is_root() {
            bail!("AUR packages cannot be built as root; run mise as a non-root user");
        }
        crate::system::sudo::ensure_elevation_available(&shell_words::join(&command))?;
        let mut runner = CmdLineRunner::new(helper);
        for arg in &args {
            runner = runner.arg(arg);
        }
        runner.raw(true).execute()
    }

    async fn upgrade(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        let pkgs = resolve_foreign_packages(pkgs)
            .await?
            .into_iter()
            .filter_map(|package| {
                package.installed_name.map(|name| PackageRequest {
                    name,
                    version: None,
                    tap_url: None,

View on GitHub (pinned to 533346cc37)