jdx/mise · error

mas cannot install a pinned version

Error message

mas cannot install a pinned version ('{p}')

What it means

The mas backend's install() rejects any PackageRequest with a pinned version. The Mac App Store only installs the current latest release of an app; there is no mechanism to install a specific older version via `mas install`, so the backend fails fast instead of ignoring the pin.

Solutions

  1. Drop the version field from mas PackageRequests so they install the latest App Store release.
  2. Install the specific older version manually (e.g. via App Store purchase history or a downloaded IPA); mas cannot do this.
  3. Filter pinned requests out before calling the mas backend and handle them with a different backend.

Example fix

// before
let pkgs = vec![PackageRequest { name: "497799835".into(), version: Some("3.2".into()) }];
backend.install(&pkgs, &opts).await?;
// after
let pkgs = vec![PackageRequest { name: "497799835".into(), version: None }];
backend.install(&pkgs, &opts).await?;
Defensive patterns

Strategy: validation

Validate before calling

if pkgs.iter().any(|p| p.version.is_some()) { /* strip or split pins before mas install */ }

Type guard

fn is_unpinned(p: &PackageRequest) -> bool { p.version.is_none() }

Prevention

When it happens

Trigger: Calling install() with at least one request whose `version` is Some — the first such request is named in the message.

Common situations: A lockfile or config pins versions for all tools uniformly and those requests are forwarded to the mas backend; reproducing an older app build by pinning its version.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

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

        }
    }

    async fn unavailable_reason_async(&self) -> Option<String> {
        self.bin().await.err().map(|err| format!("{err:#}"))
    }

    fn supports_version_pins(&self) -> bool {
        false
    }

    async fn installed(&self, pkgs: &[PackageRequest]) -> Result<Vec<PackageStatus>> {
        let apps = mas_list(self.bin().await?).await?;
        Ok(statuses_from_apps(&apps, pkgs))
    }

    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        if let Some(p) = pkgs.iter().find(|p| p.version.is_some()) {
            bail!("mas cannot install a pinned version ('{p}')");
        }
        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);

View on GitHub (pinned to 533346cc37)