{"record":{"id":"ff28292c6592d8c9","repo":"jdx/mise","slug":"mas-install-requires-a-numeric-adam-id-p-us","errorCode":null,"errorMessage":"mas install requires a numeric ADAM ID ('{p}'); use `mas search` to find it","messagePattern":"mas install requires a numeric ADAM ID \\('(.+?)'\\); use `mas search` to find it","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/mas.rs","lineNumber":260,"sourceCode":"    async fn unavailable_reason_async(&self) -> Option<String> {\n        self.bin().await.err().map(|err| format!(\"{err:#}\"))\n    }\n\n    fn supports_version_pins(&self) -> bool {\n        false\n    }\n\n    async fn installed(&self, pkgs: &[PackageRequest]) -> Result<Vec<PackageStatus>> {\n        let apps = mas_list(self.bin().await?).await?;\n        Ok(statuses_from_apps(&apps, pkgs))\n    }\n\n    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {\n        if let Some(p) = pkgs.iter().find(|p| p.version.is_some()) {\n            bail!(\"mas cannot install a pinned version ('{p}')\");\n        }\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(())","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/mas.rs#L242-L278","documentation":"mas identifies apps by numeric Apple ADAM IDs, not names. Before shelling out, install() validates every package name with is_adam_id and rejects non-numeric names with this error pointing the user at `mas search`.","triggerScenarios":"Calling mas install with a PackageRequest whose name is not a numeric ADAM ID — e.g. `mas install Xcode`, a human-readable app name, or a name with stray characters/spaces.","commonSituations":"Users copying app names from the App Store instead of IDs; configs migrated from Homebrew casks (`mas: xcode`); typos such as a leading letter or embedded whitespace in the ID.","solutions":["Find the numeric ID with `mas search <app name>` and use it as the package name","Use only digits in the package name (e.g. 497799835 for Xcode)","If constructing requests programmatically, validate with the is_adam_id check before calling install"],"exampleFix":"// before\nPackageRequest { name: \"Xcode\".into(), .. }\n// after\nPackageRequest { name: \"497799835\".into(), .. }","handlingStrategy":"validation","validationCode":"fn is_adam_id(name: &str) -> bool { !name.is_empty() && name.chars().all(|c| c.is_ascii_digit()) }","typeGuard":"fn as_adam_id(name: &str) -> Option<&str> {\n    (!name.is_empty() && name.chars().all(|c| c.is_ascii_digit())).then_some(name)\n}","tryCatchPattern":"match provider.install(&pkgs, &opts).await {\n    Err(e) if e.to_string().contains(\"numeric ADAM ID\") => {\n        eprintln!(\"resolve names with `mas search <name>` and retry\");\n    }\n    other => other?,\n}","preventionTips":["Resolve human-readable names to IDs with `mas search` at authoring time","Store ADAM IDs, not app names, in package configs","Validate numeric-only names before submitting requests"],"tags":["macos","mas","validation","package-manager"],"backgroundTag":"invalid-argument-format","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}