{"record":{"id":"03b4dc73bf4aa016","repo":"oven-sh/bun","slug":"unsupported-platform-inspect-options","errorCode":null,"errorMessage":"Unsupported platform: ${inspect(options)}","messagePattern":"Unsupported platform: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/machine.mjs","lineNumber":396,"sourceCode":"        } else {\n          name = `al${release || \"*\"}-ami-*-${arch === \"aarch64\" ? \"arm64\" : \"x86_64\"}`;\n        }\n      } else if (distro === \"alpine\") {\n        owner = \"538276064493\";\n        name = `alpine-${release || \"*\"}.*-${arch === \"aarch64\" ? \"aarch64\" : \"x86_64\"}-uefi-cloudinit-*`;\n      } else if (distro === \"centos\") {\n        owner = \"aws-marketplace\";\n        name = `CentOS-Stream-ec2-${release || \"*\"}-*.${arch === \"aarch64\" ? \"aarch64\" : \"x86_64\"}-*`;\n      }\n    } else if (os === \"windows\") {\n      if (!distro || distro === \"server\") {\n        owner = \"amazon\";\n        name = `Windows_Server-${release || \"*\"}-English-Full-Base-*`;\n      }\n    }\n\n    if (!name) {\n      throw new Error(`Unsupported platform: ${inspect(options)}`);\n    }\n\n    const baseImages = await aws.describeImages({\n      \"state\": \"available\",\n      \"owner-alias\": owner,\n      \"name\": name,\n    });\n    // console.table(baseImages.map(v => v.Name));\n\n    if (!baseImages.length) {\n      throw new Error(`No base image found: ${inspect(options)}`);\n    }\n\n    const [baseImage] = baseImages;\n    return aws.getAvailableImage(baseImage);\n  },\n\n  /**","sourceCodeStart":378,"sourceCodeEnd":414,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/machine.mjs#L378-L414","documentation":"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.","triggerScenarios":"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'.","commonSituations":"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.","solutions":["Use a supported combination: linux + debian|ubuntu|alpine|amazonlinux|centos, or windows + server","Or pass an explicit imageId in MachineOptions so getBaseImage's pattern search is skipped","If the platform is legitimately new, extend the os/distro mapping in getBaseImage (scripts/machine.mjs)"],"exampleFix":"// before\nawait aws.getBaseImage({ os: 'linux', arch: 'x64', distro: 'rhel' });\n\n// after (rhel is not mapped; centos is the closest mapped distro)\nawait aws.getBaseImage({ os: 'linux', arch: 'x64', distro: 'centos' });\n// or skip the pattern search entirely\nawait aws.getBaseImage({ os: 'linux', arch: 'x64', imageId: 'ami-0123456789abcdef0' });","handlingStrategy":"validation","validationCode":"const SUPPORTED = {\n  linux: new Set(['debian', 'ubuntu', 'alpine', 'amazonlinux', 'centos']),\n  windows: new Set(['server']),\n};\nfunction assertSupportedPlatform({ os, distro }) {\n  const set = SUPPORTED[os];\n  if (!set || (!distro && os === 'windows') || (distro && !set.has(distro))) {\n    throw new Error(`unsupported os/distro: ${os}/${distro}`);\n  }\n}","typeGuard":"function isSupportedPlatform(o) {\n  if (o.os === 'linux') return !o.distro || ['debian','ubuntu','alpine','amazonlinux','centos'].includes(o.distro);\n  if (o.os === 'windows') return !o.distro || o.distro === 'server';\n  return false;\n}","tryCatchPattern":null,"preventionTips":["Validate machine specs at config-parse time, not deep inside AWS calls","Remember 'rhel' is accepted by the sftp switch but has no AMI mapping — use centos or an explicit imageId","darwin/macos belongs to the tart provider, never AWS"],"tags":["aws","config","validation","provisioning"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}