{"record":{"id":"8a4acf0546e2c69e","repo":"jdx/mise","slug":"mise-oci-requires-an-based-base-image-when-boo","errorCode":null,"errorMessage":"mise oci requires an {}-based base image when [bootstrap.packages] contains {} entries; `scratch` has no {} metadata","messagePattern":"mise oci requires an (.+?)-based base image when \\[bootstrap\\.packages\\] contains (.+?) entries; `scratch` has no (.+?) metadata","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/oci/packages.rs","lineNumber":73,"sourceCode":"    fn name(self) -> &'static str {\n        match self {\n            Self::Apk => \"apk\",\n            Self::Apt => \"apt\",\n        }\n    }\n}\n\npub(crate) fn build_system_packages_layer(\n    layout: &ImageLayout,\n    base_layers: &[Descriptor],\n    managers: &[ManagerPackages],\n    architecture: &str,\n) -> Result<Option<SystemPackagesLayer>> {\n    let Some((manager, requests)) = collect_package_requests(managers)? else {\n        return Ok(None);\n    };\n    if base_layers.is_empty() {\n        bail!(\n            \"mise oci requires an {}-based base image when [bootstrap.packages] contains {} \\\n             entries; `scratch` has no {} metadata\",\n            manager.name(),\n            manager.name(),\n            manager.name(),\n        );\n    }\n    validate_host_requirements(manager)?;\n\n    let td = TempDir::with_prefix(format!(\"mise-oci-{}-rootfs-\", manager.name())).wrap_err_with(\n        || {\n            format!(\n                \"creating temp rootfs for {} system packages\",\n                manager.name()\n            )\n        },\n    )?;\n    let rootfs = td.path().join(\"rootfs\");","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/oci/packages.rs#L55-L91","documentation":"When `[bootstrap.packages]` entries exist, mise builds a system-packages layer by inspecting the base image's metadata (os release / package manager info). With a `scratch` (layerless) base image there are no layers to inspect, so mise cannot determine the target distro and aborts with this error naming the requested package manager.","triggerScenarios":"Running `mise oci build`/bootstrap where `[bootstrap.packages]` in the config has apt or apk entries but the base image resolves to scratch (no `base_layers`), so `build_system_packages_layer` has no metadata to work with.","commonSituations":"Building from scratch to keep images small while still asking for system packages; copying a mise.toml that installs packages into a config whose FROM was changed to scratch.","solutions":["Use a distro base image (e.g. alpine for apk, debian/ubuntu for apt) instead of scratch","Remove the `[bootstrap.packages]` entries if you truly want a from-scratch image","Bake the packages into your own base image and reference it"],"exampleFix":"// before (mise.toml)\n[bootstrap]\nfrom = \"scratch\"\n[bootstrap.packages]\napt = [\"curl\"]\n// after\n[bootstrap]\nfrom = \"debian:bookworm\"\n[bootstrap.packages]\napt = [\"curl\"]","handlingStrategy":"validation","validationCode":"# shell check before build\ngrep -q '^from = \"scratch\"' mise.toml && grep -q 'bootstrap.packages' mise.toml \\\n  && echo \"invalid: packages require a distro base image\" || true","typeGuard":null,"tryCatchPattern":"if let Err(e) = build_result {\n    if e.to_string().contains(\"`scratch` has no\") {\n        eprintln!(\"switch [bootstrap] from to a distro image or drop [bootstrap.packages]\");\n    }\n}","preventionTips":["Never combine from = \"scratch\" with [bootstrap.packages]","Keep a lint step validating bootstrap config before builds","Prefer slim distro bases (alpine, debian-slim) when you need packages","Review base-image changes after copying configs between projects"],"tags":["oci","config","packages"],"backgroundTag":"invalid-config-value","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"}