{"record":{"id":"4d041cb8c1b74e91","repo":"JuliusBrussee/caveman","slug":"unsupported-release-target-json-stringify-value","errorCode":null,"errorMessage":"unsupported release target ${JSON.stringify(value)}","messagePattern":"unsupported release target (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/build-release-binaries.mjs","lineNumber":48,"sourceCode":"  return `${name}_${os}_${arch}`;\n}\n\nexport function releaseArtifactNames(targets = RELEASE_TARGETS) {\n  return targets.flatMap(([goos, arch]) =>\n    RELEASE_BINARIES.map(([name]) => releaseArtifactName(name, goos, arch)));\n}\n\nfunction parseArgs(argv) {\n  let out = resolve(root, \"dist\", \"binaries\");\n  const targets = [];\n  for (let index = 0; index < argv.length; index++) {\n    const arg = argv[index];\n    if (arg === \"--out\") out = resolve(argv[++index] ?? \"\");\n    else if (arg === \"--target\") {\n      const value = argv[++index] ?? \"\";\n      const [goos, arch] = value.split(\"/\");\n      if (!RELEASE_TARGETS.some(([knownOS, knownArch]) => knownOS === goos && knownArch === arch)) {\n        throw new Error(`unsupported release target ${JSON.stringify(value)}`);\n      }\n      targets.push([goos, arch]);\n    } else if (arg === \"--list\") return { out, targets: RELEASE_TARGETS, list: true };\n    else throw new Error(`unknown argument ${arg}`);\n  }\n  return { out, targets: targets.length ? targets : RELEASE_TARGETS, list: false };\n}\n\nfunction build({ out, targets }) {\n  mkdirSync(out, { recursive: true });\n  const artifacts = [];\n  for (const [goos, arch] of targets) {\n    for (const [name, packagePath] of RELEASE_BINARIES) {\n      const artifact = releaseArtifactName(name, goos, arch);\n      const output = join(out, artifact);\n      process.stderr.write(`build ${artifact}\\n`);\n      const result = spawnSync(\"go\", [\"build\", \"-trimpath\", \"-o\", output, packagePath], {\n        cwd: root,","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/scripts/build-release-binaries.mjs#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the script with --list to print the exact supported GOOS/GOARCH pairs and copy one verbatim.","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.","Fix the format: the value must be exactly GOOS/GOARCH with no extra suffixes, e.g. --target linux/arm64."],"exampleFix":"# before\nnode scripts/build-release-binaries.mjs --target linux/amd64/v2\n# after\nnode scripts/build-release-binaries.mjs --target linux/amd64","handlingStrategy":"validation","validationCode":"// Mirror the script's allowlist before invoking it:\nconst RELEASE_TARGETS = new Set([\"linux/amd64\", \"linux/arm64\", \"darwin/amd64\", \"darwin/arm64\", \"windows/amd64\" /* ...sync with script */]);\nconst ok = [...RELEASE_TARGETS].length > 0 && targets.every((t) => RELEASE_TARGETS.has(t));\nif (!ok) throw new Error(\"run the script with --list to see supported targets\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call the script with --list first when unsure of supported targets.","Keep the allowlist in sync with the script when adding platforms to CI."],"tags":["cli","build","release","argument-validation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}