jdx/mise · error

apt system packages are not supported for OCI architecture

Error message

apt system packages are not supported for OCI architecture {other:?}

What it means

`apt_architecture` maps OCI architecture names to Debian apt architecture strings and only supports amd64 and arm64. Requesting apt system packages for any other OCI architecture (e.g. riscv64, ppc64le, s390x, 386) bails with this error.

Solutions

  1. Build only for amd64 or arm64 when apt system packages are declared.
  2. Remove apt entries from `[bootstrap.packages]` for unsupported architectures, or split configs per architecture.
  3. Use an apk (Alpine/Wolfi) base if Alpine supports your target arch; note apk supports the same pair today.

Example fix

# before
# mise oci build --platform linux/riscv64  with apt packages

# after
# mise oci build --platform linux/amd64
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = ['amd64', 'x86_64', 'arm64', 'aarch64'];
if ((cfg.bootstrap?.packages?.apt ?? []).length > 0 && !SUPPORTED.includes(targetArch)) throw new Error(`apt packages unsupported for arch ${targetArch}; build for amd64/arm64`);

Type guard

const aptArchSupported = (arch) => ['amd64', 'x86_64', 'arm64', 'aarch64'].includes(arch);

Try / catch

try { await miseOciBuild(cfg) } catch (e) { if (String(e).includes('apt system packages are not supported for OCI architecture')) { console.error('Restrict the build platform to linux/amd64 or linux/arm64.'); process.exit(1); } throw e; }

Prevention

When it happens

Trigger: Building an OCI image with apt entries in `[bootstrap.packages]` while the target platform architecture is anything other than amd64/x86_64/arm64/aarch64, evaluated in `prepare_and_snapshot` -> `apt_architecture`.

Common situations: Cross-building images for less common architectures (s390x on IBM Z, ppc64le, riscv64); miscapitalized or aliased arch strings in the platform config.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at src/oci/packages.rs:627

fn remove_dir_children(path: &Path) -> Result<()> {
    match fs::read_dir(path) {
        Ok(entries) => {
            for entry in entries {
                remove_path(&entry?.path())?;
            }
            Ok(())
        }
        Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(()),
        Err(e) => Err(e).wrap_err_with(|| format!("reading directory {}", path.display())),
    }
}

fn apt_architecture(oci_arch: &str) -> Result<&'static str> {
    match oci_arch {
        "amd64" | "x86_64" => Ok("amd64"),
        "arm64" | "aarch64" => Ok("arm64"),
        other => bail!("apt system packages are not supported for OCI architecture {other:?}"),
    }
}

fn apk_architecture(oci_arch: &str) -> Result<&'static str> {
    match oci_arch {
        "amd64" | "x86_64" => Ok("x86_64"),
        "arm64" | "aarch64" => Ok("aarch64"),
        other => bail!("apk system packages are not supported for OCI architecture {other:?}"),
    }
}

fn snapshot(root: &Path) -> Result<BTreeMap<PathBuf, FsEntry>> {
    let mut out = BTreeMap::new();
    for entry in WalkDir::new(root).follow_links(false).sort_by_file_name() {
        let entry = entry?;
        let rel = entry.path().strip_prefix(root)?;
        if rel.as_os_str().is_empty() {
            continue;

View on GitHub (pinned to 533346cc37)