golang/go · error
no releases found for go >= %v
Error message
no releases found for go >= %v
What it means
NewerToolchain enumerates available Go releases from the module proxy and local cache, sorted newest-to-oldest, and picks the latest patch release of the family below the newest family that meets the version floor. If no release in the list is >= the required version, this error is returned. It is a specific root cause that surfaces wrapped by error 1121.
Source
Thrown at src/cmd/go/internal/toolchain/switch.go:231
latest := ""
for i := len(list) - 1; i >= 0; i-- {
v := list[i]
if gover.Compare(v, need) < 0 {
break
}
if gover.Lang(latest) == gover.Lang(v) {
continue
}
newer := latest
latest = v
if newer != "" && !gover.IsPrerelease(newer) {
// latest is the last patch release of Go 1.X, and we saw a non-prerelease of Go 1.(X+1),
// so latest is the one we want.
break
}
}
if latest == "" {
return "", fmt.Errorf("no releases found for go >= %v", need)
}
return "go" + latest, nil
}
// HasAuto reports whether the GOTOOLCHAIN setting allows "auto" upgrades.
func HasAuto() bool {
env := cfg.Getenv("GOTOOLCHAIN")
return env == "auto" || strings.HasSuffix(env, "+auto")
}
// HasPath reports whether the GOTOOLCHAIN setting allows "path" upgrades.
func HasPath() bool {
env := cfg.Getenv("GOTOOLCHAIN")
return env == "path" || strings.HasSuffix(env, "+path")
}
View on GitHub (pinned to b6b368adc5)
Solutions
- Check the module's go.mod — the go directive may specify a version that doesn't exist yet
- Ensure network access to GOPROXY so the release list can be fetched
- Verify GOPROXY is not 'off': `go env GOPROXY`
Example fix
# before: go.mod requests a non-existent version go 1.99 # after: use a real released version go 1.23 # or override toolchain selection to local export GOTOOLCHAIN=local
Defensive patterns
Strategy: fallback
Validate before calling
# Check if the go directive references a real Go version
GO_VER=$(grep '^go ' go.mod | awk '{print $2}')
echo "go.mod requires Go $GO_VER"
echo "Latest available: see https://go.dev/dl/"
# If GO_VER doesn't exist, the build will fail Try / catch
# Fallback to local toolchain when no releases found if ! go build ./... 2>&1 | grep -q 'no releases found'; then echo 'ok' else GOTOOLCHAIN=local go build ./... fi
Prevention
- Verify the go directive in go.mod references a released Go version
- Keep GOPROXY accessible or pre-cache toolchain modules
- Set GOTOOLCHAIN=local when working offline
When it happens
Trigger: A module declares a go directive for a version that does not exist in any published release (future or typo); the proxy returned an empty list; GOPROXY=off with no cached toolchain modules; the version list was fetched but every entry was below the `need` threshold.
Common situations: go directive set to an unreleased version (e.g., `go 1.99`); typo in go directive; air-gapped environment with empty module cache; GOPROXY pointing to a mirror that hasn't synced the latest releases.
Related errors
- switching to go >= %v: %w
- failed to locate cmd/go for target platform
- failed to locate cmd/compile for target platform
- GOROOT not found
- ${GoModToolVersion} is required for tool directives in go.mo
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/f256379b77beb3d3.
Report an issue: GitHub.