oven-sh/bun · error · Error

[azure] Unsupported OS: ${os}

Error message

[azure] Unsupported OS: ${os}

What it means

Thrown by getBaseImageReference() in scripts/azure.mjs when the Azure CI provider creates a VM whose `os` value is not the literal string "windows". The provider only knows Windows marketplace images (Windows 11 24H2 Pro arm64 via MicrosoftWindowsDesktop, Windows Server 2019 Datacenter x64 via MicrosoftWindowsServer), so any other OS string fails fast before Azure resources are provisioned.

Source

Thrown at scripts/azure.mjs:444

function getBaseImageReference(os, arch) {
  if (os === "windows") {
    if (arch === "aarch64") {
      return {
        publisher: "MicrosoftWindowsDesktop",
        offer: "windows11preview-arm64",
        sku: "win11-24h2-pro",
        version: "latest",
      };
    }
    // Windows Server 2019 x64 — oldest supported version
    return {
      publisher: "MicrosoftWindowsServer",
      offer: "WindowsServer",
      sku: "2019-datacenter-gensecond",
      version: "latest",
    };
  }
  throw new Error(`[azure] Unsupported OS: ${os}`);
}

function getVmSize(arch) {
  return arch === "aarch64" ? "Standard_D4pds_v6" : "Standard_D4ds_v6";
}

// ============================================================================
// Exports
// ============================================================================

export const azure = {
  get name() {
    return "azure";
  },

  config,

  /**

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Set os to "windows" in the job config — it is the only supported value
  2. Fix typos or renames in the CI matrix so the provider receives exactly "windows"
  3. To support a new OS, add a branch in getBaseImageReference returning a publisher/offer/sku/version image reference for it

Example fix

// before
function getBaseImageReference(os, arch) {
  if (os === "windows") { /* ... */ }
  throw new Error(`[azure] Unsupported OS: ${os}`);
}

// after — support windows-2025 as well
if (os === "windows" || os === "windows-2025") {
  return {
    publisher: "MicrosoftWindowsServer",
    offer: "WindowsServer",
    sku: "2025-datacenter-azure-edition",
    version: "latest",
  };
}
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_OS = new Set(["windows"]);
if (!SUPPORTED_OS.has(os)) {
  console.error(`os "${os}" is not supported by the azure provider; supported: ${[...SUPPORTED_OS].join(", ")}`);
  process.exit(2);
}

Type guard

const isAzureSupportedOs = (os) => os === "windows";

Prevention

When it happens

Trigger: The azure provider is invoked with os set to anything except "windows" — e.g. "linux", "macos", "windows-2022", or a CI matrix entry whose os key was renamed or misspelled.

Common situations: Adding a new OS target to the CI matrix without extending getBaseImageReference (scripts/azure.mjs:426); renaming matrix keys (windows -> win); routing a Linux/macOS job to the Azure provider; typos in pipeline YAML variables.

Related errors


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