jdx/mise · error

apk failed while installing OCI system packages

Error message

apk failed while installing OCI system packages: {}
{}

What it means

mise runs the host `apk` binary to install system packages into the OCI rootfs; if apk exits non-zero, mise bails with the exit status and trimmed stderr. The error surfaces an apk-level failure (bad package name, missing repo, network error, arch mismatch).

Solutions

  1. Read the stderr in the error message; fix the named package (typo, wrong repo) or remove it from `[bootstrap.packages]`.
  2. Run `apk update`-equivalent by ensuring the base image's apk index is fresh, or add the needed repository to the image.
  3. Check network/DNS access in the build environment (CI runners often lack it).
  4. Verify the package supports the target architecture (see `apk_architecture` mapping).

Example fix

# before (mise.toml)
[bootstrap.packages]
apk = ["cur1"]  # typo

# after
[bootstrap.packages]
apk = ["curl"]
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check that package names exist in the Alpine repo
// apk search -e '^curl$' inside an alpine container before adding to [bootstrap.packages]

Try / catch

try { await miseOciBuild(cfg) } catch (e) { if (String(e).startsWith('apk failed while installing OCI system packages')) { console.error('apk stderr:', e.message.split('\n').slice(1).join('\n')); process.exit(1); } throw e; }

Prevention

When it happens

Trigger: `build_system_packages_layer` -> `apk_install_into_rootfs` runs `apk add --root <rootfs> ...` and the child process returns a non-zero status.

Common situations: Typo'd or nonexistent apk package names; apk repositories unreachable (offline CI, DNS failure); package unavailable for the target architecture; stale apk index in the base image.

Related errors


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

Appendix: source

Thrown at src/oci/packages.rs:376

        "--root".to_string(),
        rootfs.display().to_string(),
        "--arch".to_string(),
        apk_architecture(architecture)?.to_string(),
        "--no-cache".to_string(),
        "add".to_string(),
        "--".to_string(),
    ];
    args.extend(requests.iter().map(|request| match &request.version {
        Some(version) => format!("{}={version}", request.name),
        None => request.name.clone(),
    }));
    info!("apk {}", args.join(" "));
    let output = Command::new("apk")
        .args(&args)
        .output()
        .wrap_err("running apk for OCI system packages")?;
    if !output.status.success() {
        bail!(
            "apk failed while installing OCI system packages: {}\n{}",
            output.status,
            String::from_utf8_lossy(&output.stderr).trim()
        );
    }
    Ok(())
}

fn apt_install_into_rootfs(
    rootfs: &Path,
    requests: &[PackageRequest],
    architecture: &str,
) -> Result<()> {
    let status = rootfs.join("var/lib/dpkg/status");
    if let Some(parent) = status.parent() {
        file::create_dir_all(parent)?;
    }
    if !status.exists() {

View on GitHub (pinned to 533346cc37)