microsoft/typescript-go · error

Unsupported OS: ${os}

Error message

Unsupported OS: ${os}

What it means

nodeToGOOS maps Node OS names to Go GOOS values: win32 to windows, sunos to illumos, and darwin/linux/aix/android/freebsd/netbsd/openbsd pass through. Any other os string (from the platforms table or process.platform) hits the default case and throws.

Source

Thrown at Herebyfile.mjs:1613

 * @param {string} os
 * @returns {"windows" | "illumos" | "darwin" | "linux" | "aix" | "android" | "freebsd" | "netbsd" | "openbsd"}
 */
function nodeToGOOS(os) {
    switch (os) {
        case "win32":
            return "windows";
        case "sunos":
            return "illumos";
        case "darwin":
        case "linux":
        case "aix":
        case "android":
        case "freebsd":
        case "netbsd":
        case "openbsd":
            return os;
        default:
            throw new Error(`Unsupported OS: ${os}`);
    }
}

/**
 * @param {string} arch
 * @param {string} os
 * @returns {"amd64" | "386" | "mips64le" | "ppc64" | "ppc64le" | "arm" | "arm64" | "loong64" | "riscv64" | "s390x"}
 */
function nodeToGOARCH(arch, os) {
    switch (arch) {
        case "x64":
            return "amd64";
        case "ia32":
            return "386";
        case "mips64el":
            return "mips64le";
        case "ppc64":
            return os === "aix" ? "ppc64" : "ppc64le";

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Use one of the supported OS names: win32, sunos, darwin, linux, aix, android, freebsd, netbsd, openbsd
  2. Remove the invalid entry from the platforms list
  3. Run the task on a supported host platform
Defensive patterns

Strategy: type-guard

Validate before calling

const SUPPORTED_OS = new Set(["win32", "sunos", "darwin", "linux", "aix", "android", "freebsd", "netbsd", "openbsd"]);
if (!SUPPORTED_OS.has(os)) throw new Error(`Unsupported OS: ${os}`);

Type guard

/** @param {string} os @returns {boolean} */
function isSupportedOs(os) {
  return ["win32", "sunos", "darwin", "linux", "aix", "android", "freebsd", "netbsd", "openbsd"].includes(os);
}

Prevention

When it happens

Trigger: Editing the platforms table with an OS outside the supported set ("cygwin", "win64", a typo like "linuz"), or running on a host whose process.platform is not in the mapping.

Common situations: Adding new build targets by hand; typos in platform entries; running tasks on unsupported host platforms where the non-forRelease filter keeps only the host platform.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/7f7427c88fea865a. Report an issue: GitHub.