Go "unsupported GOOS/GOARCH" - Fix in CI
Not every operating-system and architecture combination is a real Go target. When a cross-compile names a pair that does not exist, the toolchain rejects it before building.
What this error means
A cross-compile fails with unsupported GOOS/GOARCH pair. A typo or an invalid OS/arch combination was set in the build environment.
go
go build: unsupported GOOS/GOARCH pair linux/i286Common causes
Invalid OS/arch pair
The chosen GOOS and GOARCH do not form a supported target, so Go refuses to build.
Typo in GOARCH
A misspelled architecture (e.g. amd86) is not in the supported list.
How to fix it
List the supported pairs
- Print the valid targets and pick one your matrix actually needs.
shell
go tool dist listSet a valid GOOS/GOARCH
- Use a known-good pair for the cross-build.
shell
GOOS=linux GOARCH=arm64 go build ./...How to prevent it
- Derive the cross matrix from go tool dist list.
- Validate GOOS/GOARCH values before building in CI.
- Avoid hand-typing arch names; use a fixed allowlist.
Related guides
Go "relocation truncated to fit" - Fix in CIFix Go "relocation truncated to fit" link errors in CI - a cgo binary exceeded the small/medium code-model ra…
Go "gccgo not supported" - Fix in CIFix Go build failing because gccgo was used in CI - a feature or flag is gc-only. Build with the standard gc…
Go cgo "undefined reference" (C link) - Fix in CIFix Go cgo "undefined reference to" link errors in CI - the linker could not find a C symbol because the libr…