jdx/mise · error

flatpak {action} failed: {}

Error message

flatpak {action} failed: {}

What it means

run_flatpak is the shared helper for the flatpak system package manager's install and upgrade actions. It inherits stdout, captures stderr, and if the flatpak subprocess exits non-zero it bails with this error including the trimmed stderr, so the user sees flatpak's own diagnostic output prefixed with which action failed.

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 afd2eddd3a)

Solutions

  1. Read the stderr in the message for flatpak's specific diagnostic and act on it.
  2. Ensure the needed remote exists: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo.
  3. Run with --assumeyes / --noninteractive (or a TTY) so prompts don't cause failure, and use --user vs --system consistently with your permissions.
  4. Check network connectivity and free disk space, then retry the flatpak command.

Example fix

// before
flatpak install flathub com.example.Missing  # fails: not found
// after
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --assumeyes flathub com.example.App
Defensive patterns

Strategy: try-catch

Validate before calling

// Verify flatpak and the remote before install/upgrade
if which("flatpak").is_err() { return Err(anyhow!("flatpak not installed")); }
let remotes = std::process::Command::new("flatpak").arg("remotes").output()?;
if !String::from_utf8_lossy(&remotes.stdout).contains("flathub") {
    return Err(anyhow!("flathub remote missing"));
}

Try / catch

match run_flatpak("install", &args).await {
    Err(e) if e.to_string().starts_with("flatpak install failed") => {
        eprintln!("{e}"); // surface flatpak's stderr to the user
        Err(e)
    }
    other => other,
}

Prevention

When it happens

Trigger: `flatpak install ...` or `flatpak upgrade ...` exits with a non-zero status — e.g. no matching remote/ref, user declined the interactive prompt, authentication failure for a restricted remote, network errors fetching the runtime, or flatpak not properly initialized.

Common situations: Installing an app id that doesn't exist in the configured remote; running non-interactively with no TTY so flatpak can't confirm; missing flathub remote; disk-space exhaustion during install; expired/missing remote credentials; offline systems.

Related errors


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