jdx/mise · error

pacman -Qi failed: {}

Error message

pacman -Qi failed: {}

What it means

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.

Source

Thrown at src/system/packages/pacman.rs:295

            installed: provider.version.clone(),
        }
    };
    Ok(provider)
}

async fn pacman_info() -> Result<String> {
    let args = ["-Qi"];
    debug!("$ pacman {}", args.join(" "));
    let output = tokio::process::Command::new("pacman")
        .args(args)
        .env("LC_ALL", "C")
        .stdin(Stdio::null())
        .stdout(Stdio::piped())
        .stderr(Stdio::piped())
        .output()
        .await?;
    if !output.status.success() {
        bail!(
            "pacman -Qi failed: {}",
            String::from_utf8_lossy(&output.stderr).trim()
        );
    }
    Ok(String::from_utf8_lossy(&output.stdout).into_owned())
}

async fn pacman_query(names: &[String]) -> Result<String> {
    if names.is_empty() {
        return Ok(String::new());
    }
    let mut args = vec!["-Q", "--"];
    args.extend(names.iter().map(String::as_str));
    debug!("$ pacman {}", args.join(" "));
    let output = tokio::process::Command::new("pacman")
        .args(&args)
        // pacman localizes diagnostics, so matching requires untranslated output
        .env("LC_ALL", "C")

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Verify the package name spelling; `pacman -Qi` fails for unknown/missing packages
  2. Check whether the package is actually installed with `pacman -Q <name>` before expecting -Qi to succeed
  3. Run `pacman -Qi <name>` manually to see the exact stderr
  4. Refresh the package database (`pacman -Sy`) if the local DB is inconsistent
Defensive patterns

Strategy: validation

Validate before calling

pacman -Q "$name" >/dev/null 2>&1 || echo "$name not installed; -Qi will fail"

Try / catch

match pacman_info(name).await {
    Err(e) if e.to_string().contains("pacman -Qi failed") => {
        eprintln!("treating {name} as not installed");
    }
    other => other?,
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


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