jdx/mise · error

pacman -T failed

Error message

pacman -T failed: {}

What it means

The pacman dependency-test command `pacman -T` exits 0 when all requirements are satisfied and 127 when some are missing (printing them to stdout) — both are normal outcomes mise accepts. Any other exit code means `pacman -T` itself failed, and mise propagates pacman's stderr under this message. It is used by deptest, which backs `resolve_installed_provider` and `installed`.

Solutions

  1. Reproduce `pacman -T <dep names>` in a shell and read the stderr printed in the error message to fix the underlying pacman problem.
  2. Clear a stale pacman lock (remove /var/lib/pacman/db.lck once no pacman process is running).
  3. Repair the local database (e.g. `pacman -Syyu`, or restore /var/lib/pacman/local from backup).
  4. Confirm the host is Arch-based; on other distros mise should use the native package backend instead.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm `pacman -T` behaves normally before dependency-testing via mise
const probe = await sh("pacman -T bash >/dev/null 2>&1; echo $?");
const code = Number(probe.trim());
if (![0, 127].includes(code)) throw new Error(`pacman -T returned unexpected code ${code}; repair pacman db first`);

Try / catch

try { await miseCheckInstalled(pkg) } catch (e) { if (String(e).includes('pacman -T failed')) { console.error('pacman deptest broke:', e.message.split(': ').slice(1).join(': ')); } else throw e; }

Prevention

When it happens

Trigger: Calling the backend's `installed` status path or `resolve_installed_provider` when `pacman -T <deps>` terminates with a signal or an exit code other than 0/127, e.g. due to a database error or an unparseable argument list.

Common situations: Corrupt or locked pacman local database; package names containing characters pacman rejects; running on a non-Arch system where pacman is a stub or a different implementation returning non-standard codes; disk-full conditions during db access.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/156838765bbd8332. Report an issue: GitHub.

Appendix: source

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

    if names.is_empty() {
        return Ok(String::new());
    }
    let mut args = vec!["-T", "--"];
    args.extend(names.iter().map(String::as_str));
    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?;
    // deptest returns 127 when at least one requirement is unsatisfied and
    // prints those requirements to stdout. Both 0 and 127 are normal.
    if !matches!(output.status.code(), Some(0 | 127)) {
        let stderr = String::from_utf8_lossy(&output.stderr);
        bail!("pacman -T failed: {}", stderr.trim());
    }
    Ok(String::from_utf8_lossy(&output.stdout).into_owned())
}

pub(super) async fn resolve_installed_provider(
    request: &PackageRequest,
    eligible_names: &HashSet<String>,
) -> Result<Option<(String, PackageState)>> {
    let requirement = deptest_requirement(request);
    let deptest = pacman_deptest(&[requirement]).await?;
    let unsatisfied = parse_pacman_deptest(&deptest);
    let constraint_satisfied = unsatisfied.is_empty();
    if !constraint_satisfied {
        if request.version.is_none() {
            return Ok(None);
        }
        let bare_deptest = pacman_deptest(std::slice::from_ref(&request.name)).await?;
        let bare_missing = parse_pacman_deptest(&bare_deptest);

View on GitHub (pinned to 533346cc37)