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
- Use one of the supported OS names: win32, sunos, darwin, linux, aix, android, freebsd, netbsd, openbsd
- Remove the invalid entry from the platforms list
- 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
- Copy OS names from the typedef comment at Herebyfile.mjs when editing the platforms table
- Lint the platforms table entries against the supported set in CI
- Remember sunos maps to illumos and win32 to windows; use the Node names, not Go names
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
- Unsupported ARCH: ${arch}
- native-preview platform list is out of sync with 'go tool di
- Unknown cert: ${cert}
- Invalid value for ${name}: ${value}
- Source file does not exist: ${src}
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/7f7427c88fea865a.
Report an issue: GitHub.