{"record":{"id":"0296cf9464c2b032","repo":"jdx/mise","slug":"pacman-qi-failed","errorCode":null,"errorMessage":"pacman -Qi failed: {}","messagePattern":"pacman -Qi failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/packages/pacman.rs","lineNumber":295,"sourceCode":"            installed: provider.version.clone(),\n        }\n    };\n    Ok(provider)\n}\n\nasync fn pacman_info() -> Result<String> {\n    let args = [\"-Qi\"];\n    debug!(\"$ pacman {}\", args.join(\" \"));\n    let output = tokio::process::Command::new(\"pacman\")\n        .args(args)\n        .env(\"LC_ALL\", \"C\")\n        .stdin(Stdio::null())\n        .stdout(Stdio::piped())\n        .stderr(Stdio::piped())\n        .output()\n        .await?;\n    if !output.status.success() {\n        bail!(\n            \"pacman -Qi failed: {}\",\n            String::from_utf8_lossy(&output.stderr).trim()\n        );\n    }\n    Ok(String::from_utf8_lossy(&output.stdout).into_owned())\n}\n\nasync fn pacman_query(names: &[String]) -> Result<String> {\n    if names.is_empty() {\n        return Ok(String::new());\n    }\n    let mut args = vec![\"-Q\", \"--\"];\n    args.extend(names.iter().map(String::as_str));\n    debug!(\"$ pacman {}\", args.join(\" \"));\n    let output = tokio::process::Command::new(\"pacman\")\n        .args(&args)\n        // pacman localizes diagnostics, so matching requires untranslated output\n        .env(\"LC_ALL\", \"C\")","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/packages/pacman.rs#L277-L313","documentation":"pacman_info runs `pacman -Qi <name>` to fetch detailed package info and bails with the command's trimmed stderr when it exits non-zero. This typically means the queried package is not installed or pacman itself reported an error.","triggerScenarios":"Any of pacman_info's callers (concrete_remove_names, resolve_installed_provider, installed) pass a package name for which `pacman -Qi` exits non-zero — the package is not installed, the name is misspelled, or pacman errors (no Arch database, non-Arch system).","commonSituations":"Checking removal state for a package already uninstalled; typos in package names in the package config; running mise on a system without a functional pacman (foreign distro) where the binary exists but the DB is broken.","solutions":["Verify the package name spelling; `pacman -Qi` fails for unknown/missing packages","Check whether the package is actually installed with `pacman -Q <name>` before expecting -Qi to succeed","Run `pacman -Qi <name>` manually to see the exact stderr","Refresh the package database (`pacman -Sy`) if the local DB is inconsistent"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"pacman -Q \"$name\" >/dev/null 2>&1 || echo \"$name not installed; -Qi will fail\"","typeGuard":null,"tryCatchPattern":"match pacman_info(name).await {\n    Err(e) if e.to_string().contains(\"pacman -Qi failed\") => {\n        eprintln!(\"treating {name} as not installed\");\n    }\n    other => other?,\n}","preventionTips":["Verify package names against `pacman -Sl` before configuring","Check installation state with `pacman -Q` before needing -Qi","Run pacman providers only on Arch-based systems"],"tags":["linux","arch","pacman","subprocess"],"backgroundTag":"command-failed","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"}