jdx/mise · error

mas install failed

Error message

mas install failed: {}

What it means

install() spawns `mas install <ids...>` (with --force when reinstall is requested); if the subprocess exits non-zero, the backend raises this error wrapping mas's trimmed stderr. The message's detail is whatever mas itself reported, so the root cause (auth, network, unknown ID) lives after the prefix.

Solutions

  1. Read mas's stderr after the prefix and address the underlying cause (sign-in, region, network).
  2. Sign in to the Mac App Store and retry; verify with `mas account`.
  3. Run the same `mas install <id>` command manually to see the full mas output and confirm the ID is valid in your region.
Defensive patterns

Strategy: try-catch

Validate before calling

let acct = Command::new("mas").arg("account").output()?;
if !acct.status.success() { /* require sign-in before install */ }

Try / catch

if let Err(e) = backend.install(&pkgs, &opts).await {
    if e.to_string().starts_with("mas install failed:") { eprintln!("{}", e); /* address sign-in/region/network and retry */ }
    else { return Err(e.into()); }
}

Prevention

When it happens

Trigger: Calling install() with valid ADAM IDs where the mas install subprocess fails: not signed in to the App Store, app not available in the user's store region, network error, or app already pending updates.

Common situations: CI/macOS setup automation installing App Store apps while not signed in; region-locked apps; Apple servers rejecting the request.

Related errors


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

Appendix: source

Thrown at src/system/packages/mas.rs:276

        }
        if let Some(p) = pkgs.iter().find(|p| !is_adam_id(&p.name)) {
            bail!("mas install requires a numeric ADAM ID ('{p}'); use `mas search` to find it");
        }
        let mut args = vec!["install".to_string()];
        args.extend(pkgs.iter().map(|p| p.name.clone()));
        if opts.dry_run {
            miseprintln!("mas {}", args.join(" "));
            return Ok(());
        }
        debug!("$ mas {}", args.join(" "));
        let output = tokio::process::Command::new(self.bin().await?)
            .args(&args)
            .stdin(Stdio::null())
            .output()
            .await?;
        if !output.status.success() {
            let stderr = String::from_utf8_lossy(&output.stderr);
            bail!("mas install failed: {}", stderr.trim());
        }
        Ok(())
    }

    async fn upgrade(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        if let Some(p) = pkgs.iter().find(|p| !is_adam_id(&p.name)) {
            bail!("mas upgrade requires a numeric ADAM ID ('{p}'); use `mas search` to find it");
        }
        let mut args = vec!["upgrade".to_string()];
        args.extend(pkgs.iter().map(|p| p.name.clone()));
        if opts.dry_run {
            miseprintln!("mas {}", args.join(" "));
            return Ok(());
        }
        debug!("$ mas {}", args.join(" "));
        let output = tokio::process::Command::new(self.bin().await?)
            .args(&args)
            .stdin(Stdio::null())

View on GitHub (pinned to 533346cc37)