jdx/mise · error

apk system packages are not supported for OCI architecture

Error message

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

What it means

apk_architecture maps the OCI container architecture string to apk's naming and found no match. Only amd64/x86_64 and arm64/aarch64 are mapped, so any other arch (e.g. 386, arm/v7, ppc64le) cannot have apk system packages installed in the OCI layer and the function bails.

Solutions

  1. Build only for x86_64 (amd64) or aarch64 (arm64) when apk system packages are declared.
  2. Remove apk entries from `[bootstrap.packages]` for unsupported architectures or maintain per-arch configs.
  3. Install needed tools inside the image with a different mechanism (e.g. a Dockerfile RUN step) for exotic architectures.

Example fix

# before
# mise oci build --platform linux/ppc64le with apk packages

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

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try { await miseOciBuild(cfg) } catch (e) { if (String(e).includes('apk 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 apk entries in `[bootstrap.packages]` while the target platform architecture is anything other than amd64/x86_64/arm64/aarch64, evaluated via `apk_architecture`.

Common situations: Cross-building Alpine-based images for riscv64, ppc64le, s390x, or 386; nonstandard arch identifiers in the platform configuration.

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/1acc66ed99f14431. Report an issue: GitHub.

Appendix: source

Thrown at src/oci/packages.rs:635

        }
        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;
        }
        out.insert(rel.to_path_buf(), fs_entry(entry.path())?);
    }
    Ok(out)
}

fn fs_entry(path: &Path) -> Result<FsEntry> {
    let md = fs::symlink_metadata(path)?;

View on GitHub (pinned to 533346cc37)