jdx/mise · error
mas upgrade failed
Error message
mas upgrade failed: {} What it means
upgrade() runs `mas upgrade <ids...>`; if the subprocess exits non-zero, the backend raises this error with mas's trimmed stderr as the detail. The actual failure reason (auth, connectivity, invalid ID) is whatever mas printed.
Solutions
- Inspect the stderr detail after the prefix and fix mas's underlying complaint (usually sign-in or network).
- Confirm sign-in with `mas account` and retry, or update via the App Store app.
- Run `mas upgrade <id>` manually to reproduce and see full mas diagnostics; also check macOS version requirements for the app.
Defensive patterns
Strategy: try-catch
Validate before calling
let acct = Command::new("mas").arg("account").output()?;
if !acct.status.success() { /* re-authenticate before upgrading */ } Try / catch
if let Err(e) = backend.upgrade(&pkgs, &opts).await {
if e.to_string().starts_with("mas upgrade failed:") { eprintln!("{}", e); /* check sign-in/network, then retry */ }
else { return Err(e.into()); }
} Prevention
- Keep the App Store session alive on machines running automated upgrades.
- Retry upgrades when offline; mas needs Apple servers.
- Run `mas outdated` first to confirm which apps actually have updates.
When it happens
Trigger: Calling upgrade() with valid ADAM IDs where `mas upgrade` fails: not signed in, network error, App Store daemon issues, or an ID with no pending/available update that mas treats as an error.
Common situations: Automated update runs on a machine whose App Store session expired; offline machines; apps requiring newer macOS than installed.
Related errors
- mas install failed
- mas list failed
- mas upgrade requires a numeric ADAM ID
- nix failed: Nix bootstrap requires modern `nix profile`…
- nix failed; see Nix's diagnostic above. Ensure nix-command…
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/d3a3f8de45c81006.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/packages/mas.rs:299
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())
.output()
.await?;
if !output.status.success() {
let stderr = String::from_utf8_lossy(&output.stderr);
bail!("mas upgrade failed: {}", stderr.trim());
}
Ok(())
}
}
pub(crate) fn is_adam_id(name: &str) -> bool {
!name.is_empty() && name.chars().all(|c| c.is_ascii_digit())
}
#[cfg(test)]
mod tests {
use super::*;
fn req(name: &str, version: Option<&str>) -> PackageRequest {
PackageRequest {
name: name.to_string(),
version: version.map(str::to_string),
tap_url: None,View on GitHub (pinned to 533346cc37)