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
- Read the stderr in the message to see apk's actual error
- Fix the underlying apk issue (e.g. wait for a concurrent apk process, run `apk update`)
- Verify apk works manually: apk info <package>
- 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
- Ensure apk database is healthy (apk update succeeds) before bootstrap
- Avoid running concurrent apk operations
- Remove apk from bootstrap managers on non-Alpine hosts
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
- apt-cache policy failed
- dpkg-query failed
- apk failed while installing OCI system packages
- apk system packages are not supported for OCI architecture
- command failed: #
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)