oven-sh/bun · error

Unsupported platform: ${inspect(options)}

Error message

Unsupported platform: ${inspect(options)}

What it means

getBaseImage() maps {os, arch, distro, release} to an AMI owner/name pattern; linux supports debian (default), ubuntu, amazonlinux, alpine, centos and windows supports server only. Any other combination leaves `name` unset and throws with the inspected options — a config-validation failure, not an AWS failure.

Source

Thrown at scripts/machine.mjs:396

        } else {
          name = `al${release || "*"}-ami-*-${arch === "aarch64" ? "arm64" : "x86_64"}`;
        }
      } else if (distro === "alpine") {
        owner = "538276064493";
        name = `alpine-${release || "*"}.*-${arch === "aarch64" ? "aarch64" : "x86_64"}-uefi-cloudinit-*`;
      } else if (distro === "centos") {
        owner = "aws-marketplace";
        name = `CentOS-Stream-ec2-${release || "*"}-*.${arch === "aarch64" ? "aarch64" : "x86_64"}-*`;
      }
    } else if (os === "windows") {
      if (!distro || distro === "server") {
        owner = "amazon";
        name = `Windows_Server-${release || "*"}-English-Full-Base-*`;
      }
    }

    if (!name) {
      throw new Error(`Unsupported platform: ${inspect(options)}`);
    }

    const baseImages = await aws.describeImages({
      "state": "available",
      "owner-alias": owner,
      "name": name,
    });
    // console.table(baseImages.map(v => v.Name));

    if (!baseImages.length) {
      throw new Error(`No base image found: ${inspect(options)}`);
    }

    const [baseImage] = baseImages;
    return aws.getAvailableImage(baseImage);
  },

  /**

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Use a supported combination: linux + debian|ubuntu|alpine|amazonlinux|centos, or windows + server
  2. Or pass an explicit imageId in MachineOptions so getBaseImage's pattern search is skipped
  3. If the platform is legitimately new, extend the os/distro mapping in getBaseImage (scripts/machine.mjs)

Example fix

// before
await aws.getBaseImage({ os: 'linux', arch: 'x64', distro: 'rhel' });

// after (rhel is not mapped; centos is the closest mapped distro)
await aws.getBaseImage({ os: 'linux', arch: 'x64', distro: 'centos' });
// or skip the pattern search entirely
await aws.getBaseImage({ os: 'linux', arch: 'x64', imageId: 'ami-0123456789abcdef0' });
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = {
  linux: new Set(['debian', 'ubuntu', 'alpine', 'amazonlinux', 'centos']),
  windows: new Set(['server']),
};
function assertSupportedPlatform({ os, distro }) {
  const set = SUPPORTED[os];
  if (!set || (!distro && os === 'windows') || (distro && !set.has(distro))) {
    throw new Error(`unsupported os/distro: ${os}/${distro}`);
  }
}

Type guard

function isSupportedPlatform(o) {
  if (o.os === 'linux') return !o.distro || ['debian','ubuntu','alpine','amazonlinux','centos'].includes(o.distro);
  if (o.os === 'windows') return !o.distro || o.distro === 'server';
  return false;
}

Prevention

When it happens

Trigger: os='darwin'/'macos' routed to the AWS provider (mac hosts are tart-only here); distro strings the switch doesn't cover, e.g. 'rhel' (only centos is mapped) or 'fedora'; typos like 'ubunut'; windows distro other than 'server'.

Common situations: Adding a new distro to CI config without extending the mapping in getBaseImage; copy-pasted machine spec with a stale distro name; macos job accidentally using cloud: aws.

Related errors


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