jdx/mise · error

flatpak failed

Error message

flatpak {action} failed: {}

What it means

run_flatpak is the shared helper that executes a flatpak subcommand for install and upgrade operations. It inherits stdout, pipes stderr, and when the flatpak process exits non-zero it bails with the collected stderr under this message.

Solutions

  1. Read the stderr included in the error for flatpak's own message
  2. Verify the app ID with `flatpak search <name>`
  3. Add the needed remote: `flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo`
  4. Install at user scope (--user) if system scope lacks permissions

Example fix

// before
flatpak install --system --noninteractive org.missing.App
// after
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --noninteractive flathub org.valid.App
Defensive patterns

Strategy: try-catch

Validate before calling

let remote = std::process::Command::new("flatpak").arg("remotes").output()?;
if !remote.status.success() || String::from_utf8_lossy(&remote.stdout).trim().is_empty() {
    // add flathub before attempting installs
}

Try / catch

match result {
    Err(e) if e.to_string().contains("flatpak install failed") => {
        eprintln!("flatpak install failed: {e}; verify app id, remote, and scope");
    }
    other => { let _ = other; }
}

Prevention

When it happens

Trigger: install() or upgrade() invokes flatpak with `install`/`upgrade` + scope arg + `--noninteractive`, and flatpak exits non-zero (bad ref, no remote, network error, no matching runtime).

Common situations: Flatpak app ID typo; remote not configured (`flatpak remote-add` missing); offline installs; --noninteractive causing immediate failure on prompts; insufficient privileges for system-wide scope.

Related errors


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

Appendix: source

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

                request: request.clone(),
                state,
            }
        })
        .collect()
}

async fn run_flatpak(args: &[String], action: &str) -> Result<()> {
    debug!("$ flatpak {}", args.join(" "));
    let output = tokio::process::Command::new("flatpak")
        .args(args)
        .stdin(Stdio::null())
        .stdout(Stdio::inherit())
        .stderr(Stdio::piped())
        .output()
        .await?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        bail!("flatpak {action} failed: {}", stderr.trim());
    }
    Ok(())
}

#[async_trait(?Send)]
impl SystemPackageManager for FlatpakManager {
    fn name(&self) -> &str {
        match self.scope {
            FlatpakScope::System => "flatpak",
            FlatpakScope::User => "flatpak-user",
        }
    }

    fn is_available(&self) -> bool {
        cfg!(target_os = "linux") && crate::file::which("flatpak").is_some()
    }

    fn unavailable_reason(&self) -> String {

View on GitHub (pinned to 533346cc37)