jdx/mise · error

mise oci cannot mix apk and apt entries in…

Error message

mise oci cannot mix apk and apt entries in [bootstrap.packages]; use the package manager matching the selected base image

What it means

`mise oci` builds system-package layers for OCI images and requires all `[bootstrap.packages]` entries to use a single package manager matching the base image. This error is thrown when a config mixes apk (Alpine-style) and apt (Debian-style) package entries, which cannot be installed into one rootfs coherently.

Solutions

  1. Open the mise.toml defining `[bootstrap.packages]` and remove either the apk entries or the apt entries so only one manager is used.
  2. Keep two separate configs and pick the one matching the base image you build from (Alpine/Wolfi -> apk, Debian/Ubuntu -> apt).
  3. If a package exists under different names per distro, list only the variant for the selected base image.

Example fix

# before (mise.toml)
[bootstrap.packages]
apk = ["curl"]
apt = ["curl"]

# after (apt-based base image)
[bootstrap.packages]
apt = ["curl"]
Defensive patterns

Strategy: validation

Validate before calling

const pkgs = cfg.bootstrap?.packages ?? {};
const managers = ["apk", "apt"].filter(m => (pkgs[m] ?? []).length > 0);
if (managers.length > 1) throw new Error(`mixing ${managers.join(" + ")} in [bootstrap.packages] is not allowed; match the base image`);

Prevention

When it happens

Trigger: Calling `mise oci build` where `collect_package_requests` (invoked via `build_system_packages_layer`) parses `[bootstrap.packages]` and finds both non-empty apk and apt entry lists.

Common situations: Copy-pasting package lists from both an Alpine and a Debian Dockerfile into one mise.toml; teams standardizing configs across differently-based images; adding a Debian package to an existing Alpine-oriented bootstrap list without removing apk entries.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at src/oci/packages.rs:199

            continue;
        }
        match mgr.manager.name() {
            "apk" => apk.extend(mgr.requests.clone()),
            "apt" => apt.extend(mgr.requests.clone()),
            other => unsupported.push(other.to_string()),
        }
    }
    if !unsupported.is_empty() {
        unsupported.sort();
        unsupported.dedup();
        bail!(
            "mise oci currently supports only apt and apk entries in [bootstrap.packages]; \
             unsupported manager(s): {}",
            unsupported.join(", ")
        );
    }
    if !apk.is_empty() && !apt.is_empty() {
        bail!(
            "mise oci cannot mix apk and apt entries in [bootstrap.packages]; use the package \
             manager matching the selected base image"
        );
    }
    if !apk.is_empty() {
        Ok(Some((OciPackageManager::Apk, apk)))
    } else if !apt.is_empty() {
        Ok(Some((OciPackageManager::Apt, apt)))
    } else {
        Ok(None)
    }
}

fn unpack_base_layers(layout: &ImageLayout, layers: &[Descriptor], rootfs: &Path) -> Result<()> {
    for layer in layers {
        let path = layout.blob_path(&layer.digest);
        let reader = open_layer_reader(layer, &path)?;
        let mut archive = Archive::new(reader);

View on GitHub (pinned to 533346cc37)