{"record":{"id":"3c76b6901f794ae5","repo":"jdx/mise","slug":"flatpak-action-failed","errorCode":null,"errorMessage":"flatpak {action} failed: {}","messagePattern":"flatpak (.+?) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/flatpak.rs","lineNumber":93,"sourceCode":"                request: request.clone(),\n                state,\n            }\n        })\n        .collect()\n}\n\nasync fn run_flatpak(args: &[String], action: &str) -> Result<()> {\n    debug!(\"$ flatpak {}\", args.join(\" \"));\n    let output = tokio::process::Command::new(\"flatpak\")\n        .args(args)\n        .stdin(Stdio::null())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::piped())\n        .output()\n        .await?;\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        bail!(\"flatpak {action} failed: {}\", stderr.trim());\n    }\n    Ok(())\n}\n\n#[async_trait(?Send)]\nimpl SystemPackageManager for FlatpakManager {\n    fn name(&self) -> &str {\n        match self.scope {\n            FlatpakScope::System => \"flatpak\",\n            FlatpakScope::User => \"flatpak-user\",\n        }\n    }\n\n    fn is_available(&self) -> bool {\n        cfg!(target_os = \"linux\") && crate::file::which(\"flatpak\").is_some()\n    }\n\n    fn unavailable_reason(&self) -> String {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/flatpak.rs#L75-L111","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Read the stderr in the message for flatpak's specific diagnostic and act on it.","Ensure the needed remote exists: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo.","Run with --assumeyes / --noninteractive (or a TTY) so prompts don't cause failure, and use --user vs --system consistently with your permissions.","Check network connectivity and free disk space, then retry the flatpak command."],"exampleFix":"// before\nflatpak install flathub com.example.Missing  # fails: not found\n// after\nflatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo\nflatpak install --assumeyes flathub com.example.App","handlingStrategy":"try-catch","validationCode":"// Verify flatpak and the remote before install/upgrade\nif which(\"flatpak\").is_err() { return Err(anyhow!(\"flatpak not installed\")); }\nlet remotes = std::process::Command::new(\"flatpak\").arg(\"remotes\").output()?;\nif !String::from_utf8_lossy(&remotes.stdout).contains(\"flathub\") {\n    return Err(anyhow!(\"flathub remote missing\"));\n}","typeGuard":null,"tryCatchPattern":"match run_flatpak(\"install\", &args).await {\n    Err(e) if e.to_string().starts_with(\"flatpak install failed\") => {\n        eprintln!(\"{e}\"); // surface flatpak's stderr to the user\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Add the flathub remote before installing apps from it","Use --assumeyes/--noninteractive when no TTY is available","Ensure adequate disk space and network access before install/upgrade","Run as root (system) or with the right --user/--system scope for the target installation"],"tags":["system-packages","flatpak","linux","subprocess"],"backgroundTag":"command-not-found","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}