{"record":{"id":"0175937b52a0b83a","repo":"jdx/mise","slug":"mas-install-failed","errorCode":null,"errorMessage":"mas install failed: {}","messagePattern":"mas install failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/mas.rs","lineNumber":276,"sourceCode":"        }\n        if let Some(p) = pkgs.iter().find(|p| !is_adam_id(&p.name)) {\n            bail!(\"mas install requires a numeric ADAM ID ('{p}'); use `mas search` to find it\");\n        }\n        let mut args = vec![\"install\".to_string()];\n        args.extend(pkgs.iter().map(|p| p.name.clone()));\n        if opts.dry_run {\n            miseprintln!(\"mas {}\", args.join(\" \"));\n            return Ok(());\n        }\n        debug!(\"$ mas {}\", args.join(\" \"));\n        let output = tokio::process::Command::new(self.bin().await?)\n            .args(&args)\n            .stdin(Stdio::null())\n            .output()\n            .await?;\n        if !output.status.success() {\n            let stderr = String::from_utf8_lossy(&output.stderr);\n            bail!(\"mas install failed: {}\", stderr.trim());\n        }\n        Ok(())\n    }\n\n    async fn upgrade(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {\n        if let Some(p) = pkgs.iter().find(|p| !is_adam_id(&p.name)) {\n            bail!(\"mas upgrade requires a numeric ADAM ID ('{p}'); use `mas search` to find it\");\n        }\n        let mut args = vec![\"upgrade\".to_string()];\n        args.extend(pkgs.iter().map(|p| p.name.clone()));\n        if opts.dry_run {\n            miseprintln!(\"mas {}\", args.join(\" \"));\n            return Ok(());\n        }\n        debug!(\"$ mas {}\", args.join(\" \"));\n        let output = tokio::process::Command::new(self.bin().await?)\n            .args(&args)\n            .stdin(Stdio::null())","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/mas.rs#L258-L294","documentation":"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.","triggerScenarios":"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.","commonSituations":"CI/macOS setup automation installing App Store apps while not signed in; region-locked apps; Apple servers rejecting the request.","solutions":["Read mas's stderr after the prefix and address the underlying cause (sign-in, region, network).","Sign in to the Mac App Store and retry; verify with `mas account`.","Run the same `mas install <id>` command manually to see the full mas output and confirm the ID is valid in your region."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"let acct = Command::new(\"mas\").arg(\"account\").output()?;\nif !acct.status.success() { /* require sign-in before install */ }","typeGuard":null,"tryCatchPattern":"if let Err(e) = backend.install(&pkgs, &opts).await {\n    if e.to_string().starts_with(\"mas install failed:\") { eprintln!(\"{}\", e); /* address sign-in/region/network and retry */ }\n    else { return Err(e.into()); }\n}","preventionTips":["Sign in to the App Store before automated installs.","Confirm the ADAM ID is available in your store region.","Dry-run (opts.dry_run) first to validate the mas command line."],"tags":["mas","subprocess","install","command-failed"],"backgroundTag":"command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}