oven-sh/bun · error

Unsupported os: ${cloudInit["os"]}

Error message

Unsupported os: ${cloudInit["os"]}

What it means

generateCloudInit() ends with a validation switch on cloudInit['os']: only 'linux' and 'windows' pass; every other value (including 'darwin'/'macos', undefined, or a typo) falls to default and throws. It's a fail-fast guard before emitting the #cloud-config user-data.

Source

Thrown at scripts/machine.mjs:680

  let sftpPath = "/usr/lib/openssh/sftp-server";
  let shell = "/bin/bash";
  switch (cloudInit["distro"]) {
    case "alpine":
      sftpPath = "/usr/lib/ssh/sftp-server";
      break;
    case "amazonlinux":
    case "rhel":
    case "centos":
      sftpPath = "/usr/libexec/openssh/sftp-server";
      break;
  }
  switch (cloudInit["os"]) {
    case "linux":
    case "windows":
      // handled above
      break;
    default:
      throw new Error(`Unsupported os: ${cloudInit["os"]}`);
  }

  let users;
  if (username === "root") {
    users = [`root:${password}`];
  } else {
    users = [`root:${password}`, `${username}:${password}`];
  }

  // https://cloudinit.readthedocs.io/en/stable/
  return `#cloud-config
users:
  - name: ${username}
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: ${shell}
    ssh_authorized_keys:
${authorizedKeys.map(key => `      - ${key}`).join("\n")}

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Set os to 'linux' or 'windows' in the machine/cloudInit config
  2. Route darwin machines to the tart provider instead of AWS cloud-init
  3. Validate os earlier in the pipeline (see type guard) so the failure surfaces at config parse time

Example fix

// before
const userData = generateCloudInit({ os: 'macos', ... });

// after
const userData = generateCloudInit({ os: 'linux', ... });
Defensive patterns

Strategy: validation

Validate before calling

const os = cloudInit['os'];
if (os !== 'linux' && os !== 'windows') {
  throw new Error(`cloudInit os must be 'linux' or 'windows', got: ${os}`);
}

Type guard

function isCloudInitOs(v) {
  return v === 'linux' || v === 'windows';
}

Prevention

When it happens

Trigger: A machine config with os 'macos'/'darwin' reaching the AWS cloud-init generator; os key missing from the config object so it's undefined; casing/typo like 'Linux' or 'linnux'.

Common situations: A tart (macOS) machine spec accidentally routed through the AWS path; hand-edited machine YAML dropping the os field.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/d804f52b083647e0. Report an issue: GitHub.