{"record":{"id":"afc8130c043cf2b7","repo":"golang/go","slug":"unrecognized-goarch-q","errorCode":null,"errorMessage":"unrecognized GOARCH %q","messagePattern":"unrecognized GOARCH %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/internal/script/conds.go","lineNumber":41,"sourceCode":"\t\t\"runtime.GOOS == <suffix>\",\n\t\tfunc(_ *State, suffix string) (bool, error) {\n\t\t\tif suffix == runtime.GOOS {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tif _, ok := syslist.KnownOS[suffix]; !ok {\n\t\t\t\treturn false, fmt.Errorf(\"unrecognized GOOS %q\", suffix)\n\t\t\t}\n\t\t\treturn false, nil\n\t\t})\n\n\tconds[\"GOARCH\"] = PrefixCondition(\n\t\t\"runtime.GOARCH == <suffix>\",\n\t\tfunc(_ *State, suffix string) (bool, error) {\n\t\t\tif suffix == runtime.GOARCH {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tif _, ok := syslist.KnownArch[suffix]; !ok {\n\t\t\t\treturn false, fmt.Errorf(\"unrecognized GOARCH %q\", suffix)\n\t\t\t}\n\t\t\treturn false, nil\n\t\t})\n\n\tconds[\"compiler\"] = PrefixCondition(\n\t\t\"runtime.Compiler == <suffix>\",\n\t\tfunc(_ *State, suffix string) (bool, error) {\n\t\t\tif suffix == runtime.Compiler {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\tswitch suffix {\n\t\t\tcase \"gc\", \"gccgo\":\n\t\t\t\treturn false, nil\n\t\t\tdefault:\n\t\t\t\treturn false, fmt.Errorf(\"unrecognized compiler %q\", suffix)\n\t\t\t}\n\t\t})\n","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/internal/script/conds.go#L23-L59","documentation":"Thrown by the script engine's built-in GOARCH prefix condition in DefaultConds. When a script uses [GOARCH:<suffix>] and the suffix neither equals runtime.GOARCH nor is present in internal/syslist.KnownArch, the condition errors instead of returning false. This surfaces misspelled architecture names that would otherwise make a condition line inert.","triggerScenarios":"Writing a condition bracket with a misspelled or non-Go architecture, e.g. [GOARCH:x86], [GOARCH:arm64be], or [GOARCH:intel]. The eval closure at conds.go:36-44 is the source.","commonSituations":"Typo in architecture name; using a vendor marketing name (e.g. 'x86' instead of '386'/'amd64', 'arm64' instead of 'arm64' is valid but 'aarch64' is not); referencing an architecture removed in a newer Go release.","solutions":["Use a valid Go GOARCH value (e.g. amd64, arm64, 386, ppc64le) — see internal/syslist.KnownArch for the full set.","Run the 'help' command in the script engine to list conditions and summaries.","Double-check against 'go tool dist list' output for the canonical spelling."],"exampleFix":"// before\n[GOARCH:x86] exec go build\n// after\n[GOARCH:amd64] exec go build","handlingStrategy":"validation","validationCode":"import \"internal/syslist\"\n\nfunc validGOARCH(v string) bool {\n    _, ok := syslist.KnownArch[v]\n    return ok\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use canonical Go GOARCH names (amd64, arm64, 386, ppc64le), not vendor names.","Validate generated suffixes against syslist.KnownArch in test helpers."],"tags":["go-script-test","conditions","goarch","go-toolchain"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}