jdx/mise · error · eyre::Report

apk info failed

Error message

apk info failed: {}

What it means

The apk system package manager backend runs `apk info` to determine installed package states. If the command exits nonzero and stderr contains anything other than blank lines or 'not found' noise, mise surfaces the stderr verbatim as a failure of apk info.

Solutions

  1. Read the stderr in the message to see apk's actual error
  2. Fix the underlying apk issue (e.g. wait for a concurrent apk process, run `apk update`)
  3. Verify apk works manually: apk info <package>
  4. If mise should not manage packages via apk on this host, remove apk from the bootstrap package managers
Defensive patterns

Strategy: try-catch

Validate before calling

apk info --help >/dev/null 2>&1 || echo 'apk unavailable on this host'

Try / catch

match result {
    Err(e) if e.to_string().contains("apk info failed") => fallback_to_manual_check(),
    other => other?,
}

Prevention

When it happens

Trigger: `apk info` exits nonzero with non-'not found' stderr — e.g. apk database locked, apk binary missing/broken, or apk reporting a real error.

Common situations: Running on an Alpine-ish system where apk is present but the world/database is corrupted or locked by another apk process; partially installed distro without a proper apk index.

Related errors


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

Appendix: source

Thrown at src/system/packages/apk.rs:95

        debug!("$ apk {}", args.join(" "));
        let output = tokio::process::Command::new("apk")
            .args(&args)
            .stdin(Stdio::null())
            .stdout(Stdio::piped())
            .stderr(Stdio::piped())
            .output()
            .await?;
        // apk info exits nonzero when any named package is not installed, but
        // still prints installed package versions. Treat unexpected stderr as
        // real apk failure instead of silently reporting everything missing.
        let stderr = String::from_utf8_lossy(&output.stderr);
        if !output.status.success()
            && !stderr.is_empty()
            && !stderr
                .lines()
                .all(|l| l.trim().is_empty() || l.contains("not found"))
        {
            bail!("apk info failed: {}", stderr.trim());
        }
        let stdout = String::from_utf8_lossy(&output.stdout);
        Ok(parse_apk_info(&stdout, pkgs))
    }

    async fn install(&self, pkgs: &[PackageRequest], opts: &InstallOpts) -> Result<()> {
        let mut args = vec!["add".to_string()];
        if opts.update {
            args.push("--update-cache".to_string());
        }
        args.push("--".to_string());
        args.extend(pkgs.iter().map(apk_name));
        if opts.dry_run {
            miseprintln!("{}", sudo::argv("apk", &args).join(" "));
            return Ok(());
        }
        sudo::run("apk", &args, &[])
    }

View on GitHub (pinned to 533346cc37)