jdx/mise · error

mise oci found apt packages in [bootstrap.packages], but…

Error message

mise oci found apt packages in [bootstrap.packages], but the base image does not contain /etc/apt. Use a Debian/Ubuntu base image or remove the apt entries.

What it means

`prepare_apt_install` verifies that the unpacked base image rootfs actually contains `/etc/apt` before running apt-get inside it. If apt packages are requested in `[bootstrap.packages]` but the base image is not Debian-based, mise bails instead of running apt-get against a foreign rootfs.

Solutions

  1. Switch the base image to a Debian/Ubuntu variant in the oci config.
  2. Remove the apt entries from `[bootstrap.packages]` and switch them to apk for an Alpine/Wolfi base.
  3. Drop the system packages entirely if the base image already provides them.

Example fix

# before (mise.toml, Alpine base)
[bootstrap.packages]
apt = ["curl"]

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

Strategy: validation

Validate before calling

if ((cfg.bootstrap?.packages?.apt ?? []).length > 0 && !/^(debian|ubuntu)/.test(baseImage)) console.warn('apt packages declared but base image is not Debian/Ubuntu');

Try / catch

try { await miseOciBuild(cfg) } catch (e) { if (String(e).includes('/etc/apt')) { console.error('Switch base image to Debian/Ubuntu or use apk entries.'); process.exit(1); } throw e; }

Prevention

When it happens

Trigger: Calling `mise oci build` with apt entries in `[bootstrap.packages]` while the selected base image lacks `/etc/apt` (e.g. Alpine or Wolfi), detected in `prepare_and_snapshot` -> `prepare_apt_install`.

Common situations: Selecting an Alpine base image but keeping apt-formatted package entries; switching the base image from Debian to distroless/Alpine without updating `[bootstrap.packages]`.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at src/oci/packages.rs:334

    Ok(true)
}

fn remove_path(path: &Path) -> Result<()> {
    match fs::symlink_metadata(path).map(|m| m.file_type()) {
        Ok(ft) if ft.is_dir() && !ft.is_symlink() => fs::remove_dir_all(path)
            .wrap_err_with(|| format!("removing directory {}", path.display()))?,
        Ok(_) => fs::remove_file(path).wrap_err_with(|| format!("removing {}", path.display()))?,
        Err(e) if e.kind() == std::io::ErrorKind::NotFound => {}
        Err(e) => {
            return Err(e).wrap_err_with(|| format!("reading metadata for {}", path.display()));
        }
    }
    Ok(())
}

fn prepare_apt_install(rootfs: &Path) -> Result<()> {
    if !rootfs.join("etc/apt").is_dir() {
        bail!(
            "mise oci found apt packages in [bootstrap.packages], but the base image does not \
             contain /etc/apt. Use a Debian/Ubuntu base image or remove the apt entries."
        );
    }
    prepare_apt_rootfs(rootfs)
}

fn prepare_apk_install(rootfs: &Path) -> Result<()> {
    if !rootfs.join("etc/apk").is_dir() || !rootfs.join("lib/apk/db").is_dir() {
        bail!(
            "mise oci found apk packages in [bootstrap.packages], but the base image does not \
             contain an apk database. Use an Alpine/Wolfi base image or remove the apk entries."
        );
    }
    Ok(())
}

fn apk_install_into_rootfs(

View on GitHub (pinned to 533346cc37)