jdx/mise · error

could not determine OS release

Error message

could not determine OS release

What it means

mise needs to know the target Linux distribution (id-version, e.g. ubuntu-24.04) to pick the right precompiled Erlang build. When not on Linux (cross-platform lock resolution path shown here is the fallback, but on Linux without ImageOS) and /etc/os-release cannot be parsed, mise cannot determine which build to select and bails.

Solutions

  1. Install the base-files/os-release package or restore /etc/os-release (e.g. `apt-get install base-files` on Debian-based images)
  2. Set the ImageOS env var to a supported value (e.g. ubuntu24) as a workaround
  3. Use a standard distro base image (ubuntu:24.04) for the install step
  4. Compile from source, which still needs os-release only for lock resolution — avoid cross-target lock resolution

Example fix

# before
FROM scratch  # no /etc/os-release
# after
FROM ubuntu:24.04  # provides /etc/os-release
RUN mise install erlang@26.2
Defensive patterns

Strategy: fallback

Validate before calling

test -f /etc/os-release && echo "os-release present" || echo "restore os-release or set ImageOS"

Try / catch

catch (e) {
  if (/could not determine OS release/.test(String(e))) {
    // use standard base image or set ImageOS=ubuntu24 then retry
  }
}

Prevention

When it happens

Trigger: `mise install erlang@<version>` (or lock resolution) on Linux where neither the ImageOS env var nor a parseable /etc/os-release file exists — e.g. minimal/minimal-images containers without os-release, or exotic distros.

Common situations: Scratch/distroless Docker images lacking /etc/os-release; heavily stripped container images; custom minimal Linux builds.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at src/plugins/core/erlang.rs:236

                "ubuntu-26.04",
            ]
            .contains(&os.as_str())
            {
                bail!("unsupported OS version: {os}");
            }
            return Ok(os);
        } else if Platform::current().is_linux() {
            if let Ok(os) = std::env::var("ImageOS") {
                match os.as_str() {
                    "ubuntu24" => "ubuntu-24.04".to_string(),
                    "ubuntu22" => "ubuntu-22.04".to_string(),
                    "ubuntu20" => "ubuntu-20.04".to_string(),
                    _ => os,
                }
            } else if let Some(os_release) = linux_os_release() {
                format!("{}-{}", os_release.id, os_release.version_id)
            } else {
                bail!("could not determine OS release");
            }
        } else {
            // Cross-platform Linux lock resolution cannot inspect the target
            // distro, so use Bob's newest supported Ubuntu build.
            "ubuntu-24.04".to_string()
        };

        // Keep automatic targets stable so existing optionless source locks continue to match.
        // Other targets and glibc distributions can opt in with erlang.precompiled_os.
        if !["ubuntu-20.04", "ubuntu-22.04", "ubuntu-24.04"].contains(&os_ver.as_str()) {
            bail!("unsupported OS version: {os_ver}");
        }
        Ok(os_ver)
    }

    fn macos_asset_name(target: &PlatformTarget) -> Result<String> {
        let arch = match target.arch_name() {
            "x64" => "x86_64",

View on GitHub (pinned to 533346cc37)