{"record":{"id":"781c3a8a8a80ac83","repo":"jdx/mise","slug":"flatpak-list-failed","errorCode":null,"errorMessage":"flatpak list failed: {}","messagePattern":"flatpak list failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/flatpak.rs","lineNumber":138,"sourceCode":"        false\n    }\n\n    async fn installed(&self, pkgs: &[PackageRequest]) -> Result<Vec<PackageStatus>> {\n        if pkgs.is_empty() {\n            return Ok(vec![]);\n        }\n        let args = [\"list\", self.scope_arg(), \"--columns=application,version\"];\n        debug!(\"$ flatpak {}\", args.join(\" \"));\n        let output = tokio::process::Command::new(\"flatpak\")\n            .args(args)\n            .stdin(Stdio::null())\n            .stdout(Stdio::piped())\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 list failed: {}\", stderr.trim());\n        }\n        Ok(parse_flatpak_list(\n            &String::from_utf8_lossy(&output.stdout),\n            pkgs,\n        ))\n    }\n\n    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {\n        if let Some(pkg) = pkgs.iter().find(|pkg| pkg.version.is_some()) {\n            bail!(\"flatpak cannot install a pinned version ('{pkg}')\");\n        }\n        let mut args = vec![\n            \"install\".to_string(),\n            self.scope_arg().to_string(),\n            \"--noninteractive\".to_string(),\n        ];\n        args.extend(pkgs.iter().map(|pkg| pkg.name.clone()));\n        if opts.dry_run {","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/packages/flatpak.rs#L120-L156","documentation":"The Flatpak manager's installed() runs `flatpak list` with both stdout and stderr piped to determine which requested packages are installed. A non-zero exit means the installed-state query itself failed, so it bails with the stderr instead of parsing output.","triggerScenarios":"installed() executes `flatpak list ...` and the process exits non-zero — flatpak itself is broken, the installation is corrupted, or arguments/permissions are wrong.","commonSituations":"Broken flatpak installation (missing runtime dirs); corrupted ~/.local/share/flatpak; container images where flatpak metadata is absent; permission problems on the flatpak repo.","solutions":["Run `flatpak list` manually to see the real error","Repair the installation with `flatpak repair`","Reinstall flatpak if the binary installation is broken","Check ~/.local/share/flatpak and /var/lib/flatpak permissions"],"exampleFix":"// before\n$ flatpak list\nerror: ...corrupted...\n// after\n$ flatpak repair\n$ flatpak list","handlingStrategy":"try-catch","validationCode":"let out = std::process::Command::new(\"flatpak\").args([\"list\", \"--app\"]).output()?;\nif !out.status.success() {\n    // run `flatpak repair` before querying installed packages\n}","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"flatpak list failed\") => {\n        eprintln!(\"installed-state query failed: {e}; try `flatpak repair`\");\n    }\n    other => { let _ = other; }\n}","preventionTips":["Keep the flatpak installation healthy (`flatpak repair` after failures)","Confirm `flatpak list` works standalone before automating queries"],"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"}