Skip to content
Latchkey

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/i286

Common 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

  1. Print the valid targets and pick one your matrix actually needs.
shell
go tool dist list

Set a valid GOOS/GOARCH

  1. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →