{"record":{"id":"64816ae6a0689aad","repo":"jdx/mise","slug":"mise-oci-found-apk-packages-in-bootstrap-packages","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":344,"sourceCode":"            return Err(e).wrap_err_with(|| format!(\"reading metadata for {}\", path.display()));\n        }\n    }\n    Ok(())\n}\n\nfn prepare_apt_install(rootfs: &Path) -> Result<()> {\n    if !rootfs.join(\"etc/apt\").is_dir() {\n        bail!(\n            \"mise oci found apt packages in [bootstrap.packages], but the base image does not \\\n             contain /etc/apt. Use a Debian/Ubuntu base image or remove the apt entries.\"\n        );\n    }\n    prepare_apt_rootfs(rootfs)\n}\n\nfn prepare_apk_install(rootfs: &Path) -> Result<()> {\n    if !rootfs.join(\"etc/apk\").is_dir() || !rootfs.join(\"lib/apk/db\").is_dir() {\n        bail!(\n            \"mise oci found apk packages in [bootstrap.packages], but the base image does not \\\n             contain an apk database. Use an Alpine/Wolfi base image or remove the apk entries.\"\n        );\n    }\n    Ok(())\n}\n\nfn apk_install_into_rootfs(\n    rootfs: &Path,\n    requests: &[PackageRequest],\n    architecture: &str,\n) -> Result<()> {\n    let mut args = vec![\n        \"--root\".to_string(),\n        rootfs.display().to_string(),\n        \"--arch\".to_string(),\n        apk_architecture(architecture)?.to_string(),\n        \"--no-cache\".to_string(),","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/packages.rs#L326-L362","documentation":"`prepare_apk_install` checks that the base image rootfs contains an apk database (`/etc/apk` and `/lib/apk/db`) before installing apk packages. If apk entries are requested but the base image is not Alpine-family, mise bails with this error.","triggerScenarios":"Calling `mise oci build` with apk entries in `[bootstrap.packages]` while `prepare_and_snapshot` -> `prepare_apk_install` finds the rootfs missing `/etc/apk` or `/lib/apk/db` (e.g. Debian/Ubuntu base).","commonSituations":"Selecting a Debian base image but keeping apk-formatted package entries; copying an Alpine-oriented mise.toml onto a Debian-based project.","solutions":["Switch the base image to an Alpine/Wolfi variant in the oci config.","Remove the apk entries from `[bootstrap.packages]` and switch them to apt for a Debian/Ubuntu base.","Drop the system packages entirely if the base image already provides them."],"exampleFix":"# before (mise.toml, Debian base)\n[bootstrap.packages]\napk = [\"curl\"]\n\n# after\n[bootstrap.packages]\napt = [\"curl\"]","handlingStrategy":"validation","validationCode":"if ((cfg.bootstrap?.packages?.apk ?? []).length > 0 && !/^(alpine|wolfi|chainguard)/.test(baseImage)) console.warn('apk packages declared but base image lacks an apk database');","typeGuard":null,"tryCatchPattern":"try { await miseOciBuild(cfg) } catch (e) { if (String(e).includes('apk database')) { console.error('Switch base image to Alpine/Wolfi or use apt entries.'); process.exit(1); } throw e; }","preventionTips":["Match package-manager keys in `[bootstrap.packages]` to the base image distro.","When changing base images, audit `[bootstrap.packages]` in the same PR.","Add a CI check that asserts distro and manager key agree."],"tags":["oci","apk","base-image","config"],"backgroundTag":"incompatible-source-type","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}