Go "go.mod requires go >= 1.X" Toolchain Download Errors in CI
Resolving the module graph requires a newer Go toolchain than the runner has, and GOTOOLCHAIN=local (or an offline runner) prevents Go from downloading it. The command refuses before building.
What this error means
A go command fails immediately with go.mod requires go >= 1.X (running go 1.Y; GOTOOLCHAIN=local). It happens after a dependency bumped its go directive above your installed toolchain.
go output
go: go.mod requires go >= 1.23 (running go 1.21; GOTOOLCHAIN=local)Common causes
A dependency raised the required Go version
An upgraded module set a higher go 1.X directive, which propagates into your build’s minimum toolchain requirement.
GOTOOLCHAIN=local blocks auto-download
With local, Go will not fetch a newer toolchain to satisfy the requirement, so it errors instead of upgrading itself.
How to fix it
Install a new enough Go in CI
.github/workflows/ci.yml
- uses: actions/setup-go@v5
with:
go-version: '1.23'Allow toolchain auto-management
Let Go download the required toolchain on demand.
Terminal
export GOTOOLCHAIN=auto
go build ./...Pin a dependency version that fits your toolchain
- Identify which dependency raised the requirement (
go mod graph). - If you cannot upgrade Go yet, pin that dependency to a release with a lower
godirective. - Plan the toolchain upgrade rather than holding back indefinitely.
How to prevent it
- Keep the CI Go version aligned with your dependencies’ requirements.
- Leave
GOTOOLCHAIN=autounless you deliberately pin. - Upgrade the toolchain proactively when dependencies move.
Related guides
Go "note: module requires Go 1.X" - Fix Version Mismatch in CIFix Go "note: module requires Go 1.X" build errors in CI - the toolchain is older than a dependency or your g…
Go "go mod tidy" Failures in CI - Diagnose tidy ErrorsFix Go "go mod tidy" failures in CI - unresolved imports, "updates to go.mod needed", or a tidy that fails be…
Go "cannot find module providing package" - Fix in CIFix Go "no required module provides package; to add it: go get" in CI - an import has no matching require in…