jdx/mise · error

mas upgrade requires a numeric ADAM ID

Error message

mas upgrade requires a numeric ADAM ID ('{p}'); use `mas search` to find it

What it means

Like install(), upgrade() validates that every requested package name is a numeric ADAM ID before invoking `mas upgrade`. Non-numeric names are rejected with this message pointing the user at `mas search`. Note upgrade() does not reject pinned versions — only malformed identifiers.

Solutions

  1. Replace the app name with its numeric ADAM ID found via `mas search <name>`.
  2. Extract the id from the App Store URL (apps.apple.com/app/id<NUMBER>).
  3. Fix the entry in the config or request list and rerun the upgrade.

Example fix

// before
mas = ["xcode", "497799835"]
// after
mas = ["497799835"]
Defensive patterns

Strategy: validation

Validate before calling

fn is_adam_id(name: &str) -> bool { !name.is_empty() && name.chars().all(|c| c.is_ascii_digit()) }
// assert all upgrade targets pass before calling upgrade

Type guard

fn is_adam_id(name: &str) -> bool { !name.is_empty() && name.chars().all(|c| c.is_ascii_digit()) }

Prevention

When it happens

Trigger: Calling upgrade() with any PackageRequest whose name fails is_adam_id (non-numeric, contains letters, or empty); the first offending name appears in the message.

Common situations: Config listing app names instead of numeric IDs; upstream tooling passing display names through to all backends uniformly.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

            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())
            .output()
            .await?;
        if !output.status.success() {
            let stderr = String::from_utf8_lossy(&output.stderr);
            bail!("mas upgrade failed: {}", stderr.trim());
        }
        Ok(())

View on GitHub (pinned to 533346cc37)