jdx/mise · error

flatpak cannot upgrade a pinned version

Error message

flatpak cannot upgrade a pinned version ('{pkg}')

What it means

The flatpak package backend refuses to run `flatpak update` when any requested PackageRequest pins a specific version. Flatpak itself has no concept of upgrading a ref to a chosen older/newer version — updates move an installed app to whatever the remote currently offers. The backend fails fast rather than silently ignoring the pin.

Solutions

  1. Remove the version pin from the flatpak PackageRequest so `version` is None, then retry the upgrade.
  2. If you need the exact pinned version, uninstall and `flatpak install` the specific commit/version instead of using upgrade.
  3. Filter pinned packages out of the upgrade batch in the caller and only pass unpinned requests to the flatpak backend.

Example fix

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

Strategy: validation

Validate before calling

let unpinned: Vec<_> = pkgs.iter().filter(|p| p.version.is_none()).collect();
if unpinned.len() != pkgs.len() { /* strip pins or handle separately before calling upgrade */ }

Type guard

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

Prevention

When it happens

Trigger: Calling `upgrade` on the flatpak backend with a pkgs slice containing at least one PackageRequest whose `version` field is Some. Empty request lists short-circuit to Ok(()) before this check.

Common situations: A config or lockfile records a concrete version for a flatpak-installed app (e.g. from a cross-backend toolset snapshot) and the user runs an upgrade-all flow; tooling that generically passes resolved versions to every package backend.

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/1253819e3abbbcf1. Report an issue: GitHub.

Appendix: source

Thrown at src/system/packages/flatpak.rs:168

        let mut args = vec![
            "install".to_string(),
            self.scope_arg().to_string(),
            "--noninteractive".to_string(),
        ];
        args.extend(pkgs.iter().map(|pkg| pkg.name.clone()));
        if opts.dry_run {
            miseprintln!("flatpak {}", args.join(" "));
            return Ok(());
        }
        run_flatpak(&args, "install").await
    }

    async fn upgrade(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        if pkgs.is_empty() {
            return Ok(());
        }
        if let Some(pkg) = pkgs.iter().find(|pkg| pkg.version.is_some()) {
            bail!("flatpak cannot upgrade a pinned version ('{pkg}')");
        }
        let mut args = vec![
            "update".to_string(),
            self.scope_arg().to_string(),
            "--noninteractive".to_string(),
        ];
        args.extend(pkgs.iter().map(|pkg| pkg.name.clone()));
        if opts.dry_run {
            miseprintln!("flatpak {}", args.join(" "));
            return Ok(());
        }
        run_flatpak(&args, "update").await
    }
}

#[cfg(test)]
mod tests {
    use super::*;

View on GitHub (pinned to 533346cc37)