{"record":{"id":"19a8c22415af6715","repo":"golang/go","slug":"unsupported-goos-goarch-pair-s-s","errorCode":null,"errorMessage":"unsupported GOOS/GOARCH pair %s/%s","messagePattern":"unsupported GOOS/GOARCH pair (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/work/action.go","lineNumber":377,"sourceCode":"func closeBuilders() {\n\tleakedBuilders := 0\n\tbuilderWorkDirs.Range(func(bi, _ any) bool {\n\t\tleakedBuilders++\n\t\tif err := bi.(*Builder).Close(); err != nil {\n\t\t\tbase.Error(err)\n\t\t}\n\t\treturn true\n\t})\n\n\tif leakedBuilders > 0 && base.GetExitStatus() == 0 {\n\t\tfmt.Fprintf(os.Stderr, \"go: internal error: Builder leaked on successful exit\\n\")\n\t\tbase.SetExitStatus(1)\n\t}\n}\n\nfunc CheckGOOSARCHPair(goos, goarch string) error {\n\tif !platform.BuildModeSupported(cfg.BuildContext.Compiler, \"default\", goos, goarch) {\n\t\treturn fmt.Errorf(\"unsupported GOOS/GOARCH pair %s/%s\", goos, goarch)\n\t}\n\treturn nil\n}\n\n// NewObjdir returns the name of a fresh object directory under b.WorkDir.\n// It is up to the caller to call b.Mkdir on the result at an appropriate time.\n// The result ends in a slash, so that file names in that directory\n// can be constructed with direct string addition.\n//\n// NewObjdir must be called only from a single goroutine at a time,\n// so it is safe to call during action graph construction, but it must not\n// be called during action graph execution.\nfunc (b *Builder) NewObjdir() string {\n\tb.objdirSeq++\n\treturn str.WithFilePathSeparator(filepath.Join(b.WorkDir, fmt.Sprintf(\"b%03d\", b.objdirSeq)))\n}\n\n// readpkglist returns the list of packages that were built into the shared library","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/work/action.go#L359-L395","documentation":"CheckGOOSARCHPair returns this when platform.BuildModeSupported reports that the (compiler, \"default\", goos, goarch) tuple has no support. It gates cross-compilation targets: only GOOS/GOARCH pairs the toolchain was built to know about are allowed.","triggerScenarios":"Calling CheckGOOSARCHPair (used by 'go build/env/list' target validation, CGO cross-compile setup, and platform checks) with a pair the installed Go toolchain doesn't ship — e.g. GOIOS=arm64 with a non-darwin GOARCH, or a misspelled GOARCH like 'amd64x'.","commonSituations":"Typos in GOOS/GOARCH env vars; targeting a pair that requires a separate Go installation (e.g. wasi or a custom platform); mixing GOARCH=mips with a gc toolchain that lacks that port.","solutions":["Run 'go tool dist list' to see supported pairs and copy the exact spelling.","Install a Go toolchain that includes the desired port (some ports are gated by build tags or require gccgo).","For gccgo-only targets, build with -compiler=gccgo (CheckGOOSARCHPair queries the configured compiler).","Check for typos: GOARCH values are lowercase, GOOS too."],"exampleFix":"// before\n$ GOOS=linux GOARCH=x86_64 go build\n// error: unsupported GOOS/GOARCH pair linux/x86_64\n\n// after — use the correct GOARCH token\n$ GOOS=linux GOARCH=amd64 go build","handlingStrategy":"validation","validationCode":"// Confirm a GOOS/GOARCH pair is supported before building.\nfunc checkPair(goos, goarch string) error {\n    out, err := exec.Command(\"go\", \"tool\", \"dist\", \"list\").Output()\n    if err != nil { return err }\n    want := goos + \"/\" + goarch + \"\\n\"\n    if !bytes.Contains(out, []byte(want)) {\n        return fmt.Errorf(\"%s is not a supported GOOS/GOARCH pair\", want)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always cross-check cross-compile targets against 'go tool dist list'.","Pin GOOS/GOARCH in CI from that list rather than typing them.","Suspect typos first: values are lowercase (e.g. amd64, not AMD64)."],"tags":["cross-compile","platform","build","validation"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}