microsoft/typescript-go · error · Error
native-preview platform list is out of sync with 'go tool di
Error message
native-preview platform list is out of sync with 'go tool dist list':\n${errors.map(e => ` - ${e}`).join("\n")} What it means
The script compares the set of platform packages it produces against `go tool dist list` (filtered by an exclusion policy). Missing or unexpected platforms each add a detailed bullet, and the aggregate throw keeps the native-preview package matrix in sync with the Go toolchain.
Source
Thrown at Herebyfile.mjs:1803
for (const [os, arch] of packagePlatforms) {
const goTarget = `${nodeToGOOS(os)}/${nodeToGOARCH(arch, os)}`;
if (!goTargetSet.has(goTarget)) {
errors.push(`Configured package platform ${os}-${arch} maps to unsupported Go target ${goTarget}.`);
}
}
const missing = [...expected].filter(platform => !actual.has(platform));
if (missing.length) {
errors.push(`Missing package platform(s) for the current Go toolchain: ${missing.join(", ")}.`);
}
const extra = [...actual].filter(platform => !expected.has(platform));
if (extra.length) {
errors.push(`Unexpected package platform(s), or missing exclusion policy: ${extra.join(", ")}.`);
}
if (errors.length) {
throw new Error(`native-preview platform list is out of sync with 'go tool dist list':\n${errors.map(e => ` - ${e}`).join("\n")}`);
}
}
/**
* Recursively strips `@typescript/source` export conditions from a package.json object.
* Processes `exports` and `imports` fields, skipping past subpath keys (starting with "."
* or "#") and recursing into condition objects. After removal, simplifies objects that have
* only a single `default` key down to their bare value.
* @param {Record<string, any>} packageJson
*/
function stripSourceConditions(packageJson) {
for (const field of ["exports", "imports"]) {
if (packageJson[field] != null && typeof packageJson[field] === "object") {
packageJson[field] = stripConditionsFromValue(packageJson[field]);
}
}
}
View on GitHub (pinned to 1bcfa18d79)
Solutions
- Read the two bullet lines: they name exactly which platform(s) are missing or unexpected
- Update the platforms table and/or the exclusion policy in Herebyfile.mjs to match the new `go tool dist list` output
- Or pin the Go toolchain to the version the table was generated from until the table is updated
Example fix
# before go 1.23 # table generated for 1.22, new target riscv64/ios appears # after # update the platforms table / exclusion policy for riscv64/ios, or pin: go 1.22
Defensive patterns
Strategy: validation
Validate before calling
import { execSync } from "node:child_process";
const dist = new Set(execSync("go tool dist list", { encoding: "utf8" })
.trim().split("\n").map(l => l.replace("/", "-")));
for (const p of expectedPlatforms) {
if (!dist.has(p) && !exclusionPolicy.has(p)) throw new Error(`Platform ${p} not in dist list; update table or policy.`);
} Prevention
- After any Go toolchain bump, diff the platforms table against `go tool dist list` output
- Update the exclusion policy together with the platforms table in one change
- Add a CI check that runs the platform sync comparison before release packaging
When it happens
Trigger: Upgrading the Go toolchain adds or removes a supported GOOS/GOARCH target so the expected and actual sets diverge; or the platforms table / exclusion policy in Herebyfile.mjs was edited incompletely.
Common situations: Go version bumps in CI or go.mod; a contributor adding a platform to the table but not the policy (or vice versa); new experimental Go targets appearing in dist list.
Related errors
- Unsupported OS: ${os}
- Unsupported ARCH: ${arch}
- %s: %w
- Publishing as 'typescript' requires a version before selecti
- Refusing to publish 'typescript' with the latest tag from no
AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16).
Data as JSON: /api/errors/82312a11382df73d.
Report an issue: GitHub.