{"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/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/flatpak.rs#L75-L111","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Read the stderr included in the error for flatpak's own message","Verify the app ID with `flatpak search <name>`","Add the needed remote: `flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo`","Install at user scope (--user) if system scope lacks permissions"],"exampleFix":"// before\nflatpak install --system --noninteractive org.missing.App\n// after\nflatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo\nflatpak install --user --noninteractive flathub org.valid.App","handlingStrategy":"try-catch","validationCode":"let remote = std::process::Command::new(\"flatpak\").arg(\"remotes\").output()?;\nif !remote.status.success() || String::from_utf8_lossy(&remote.stdout).trim().is_empty() {\n    // add flathub before attempting installs\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"flatpak install failed\") => {\n        eprintln!(\"flatpak install failed: {e}; verify app id, remote, and scope\");\n    }\n    other => { let _ = other; }\n}","preventionTips":["Verify app IDs with `flatpak search` first","Ensure the flathub (or target) remote is configured","Use --user scope when system-wide privileges are unavailable"],"tags":["flatpak","system-packages","process"],"backgroundTag":"command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}