JuliusBrussee/caveman · error

unsupported release target ${JSON.stringify(value)}

Error message

unsupported release target ${JSON.stringify(value)}

What it means

Thrown by the release-binary build script's argument parser when a --target value does not match any entry in the script's RELEASE_TARGETS matrix (an allowlist of supported GOOS/GOARCH pairs). It is a strict allowlist because release artifacts, naming, and checksums are only defined for the curated target set; arbitrary go os/arch combos are rejected up front rather than producing untracked artifacts.

Source

Thrown at scripts/build-release-binaries.mjs:48

  return `${name}_${os}_${arch}`;
}

export function releaseArtifactNames(targets = RELEASE_TARGETS) {
  return targets.flatMap(([goos, arch]) =>
    RELEASE_BINARIES.map(([name]) => releaseArtifactName(name, goos, arch)));
}

function parseArgs(argv) {
  let out = resolve(root, "dist", "binaries");
  const targets = [];
  for (let index = 0; index < argv.length; index++) {
    const arg = argv[index];
    if (arg === "--out") out = resolve(argv[++index] ?? "");
    else if (arg === "--target") {
      const value = argv[++index] ?? "";
      const [goos, arch] = value.split("/");
      if (!RELEASE_TARGETS.some(([knownOS, knownArch]) => knownOS === goos && knownArch === arch)) {
        throw new Error(`unsupported release target ${JSON.stringify(value)}`);
      }
      targets.push([goos, arch]);
    } else if (arg === "--list") return { out, targets: RELEASE_TARGETS, list: true };
    else throw new Error(`unknown argument ${arg}`);
  }
  return { out, targets: targets.length ? targets : RELEASE_TARGETS, list: false };
}

function build({ out, targets }) {
  mkdirSync(out, { recursive: true });
  const artifacts = [];
  for (const [goos, arch] of targets) {
    for (const [name, packagePath] of RELEASE_BINARIES) {
      const artifact = releaseArtifactName(name, goos, arch);
      const output = join(out, artifact);
      process.stderr.write(`build ${artifact}\n`);
      const result = spawnSync("go", ["build", "-trimpath", "-o", output, packagePath], {
        cwd: root,

View on GitHub (pinned to 27d5a3981a)

Solutions

  1. Run the script with --list to print the exact supported GOOS/GOARCH pairs and copy one verbatim.
  2. If you genuinely need the new target, add it to the RELEASE_TARGETS array in scripts/build-release-binaries.mjs (and any naming/checksum conventions it implies), then re-run.
  3. Fix the format: the value must be exactly GOOS/GOARCH with no extra suffixes, e.g. --target linux/arm64.

Example fix

# before
node scripts/build-release-binaries.mjs --target linux/amd64/v2
# after
node scripts/build-release-binaries.mjs --target linux/amd64
Defensive patterns

Strategy: validation

Validate before calling

// Mirror the script's allowlist before invoking it:
const RELEASE_TARGETS = new Set(["linux/amd64", "linux/arm64", "darwin/amd64", "darwin/arm64", "windows/amd64" /* ...sync with script */]);
const ok = [...RELEASE_TARGETS].length > 0 && targets.every((t) => RELEASE_TARGETS.has(t));
if (!ok) throw new Error("run the script with --list to see supported targets");

Prevention

When it happens

Trigger: Running scripts/build-release-binaries.mjs with e.g. --target linux/riscv64 or a malformed value like --target linux (missing /arch), --target "linux-amd64", or a typo such as --target linux/amd64-extra when that pair is not in RELEASE_TARGETS.

Common situations: Trying to build for a newly added Go platform without updating RELEASE_TARGETS; copy-pasting a docker-style platform tag (linux/amd64/v2); forgetting the arch half of the pair; trailing whitespace or shell quoting issues producing "value" with embedded spaces.

Related errors


AI-assisted analysis of JuliusBrussee/caveman@27d5a3981a (2026-08-15). Data as JSON: /api/errors/4d041cb8c1b74e91. Report an issue: GitHub.