Go module download i/o timeout from proxy - Fix in CI
A module download stalled or dropped mid-fetch - a 5xx, a reset, or a timeout. These are transient network failures that almost always succeed on retry.
What this error means
A go mod download fails partway with i/o timeout, connection reset by peer, or a 5xx from the proxy. Re-running the job usually works unchanged, the hallmark of a transient issue.
go
go: github.com/foo/bar@v1.0.0: reading https://proxy.golang.org/github.com/foo/bar/@v/v1.0.0.zip:
dial tcp 142.250.0.0:443: i/o timeoutCommon causes
Transient proxy or network failure
The proxy or the path between the runner and it dropped momentarily, timing out the fetch.
No module cache between jobs
Every job re-downloads from the network, multiplying exposure to transient failures.
How to fix it
Retry the download
- Wrap go mod download in a short bounded retry; transient failures usually clear immediately.
.github/workflows/ci.yml
for i in 1 2 3; do go mod download && break; sleep 5; doneCache the module cache
- Cache the Go module cache so warm jobs avoid the network entirely.
.github/workflows/ci.yml
- uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go-mod-${{ hashFiles('**/go.sum') }}How to prevent it
- Cache
~/go/pkg/modkeyed on go.sum. - Add a bounded retry around module downloads.
- Consider a closer module mirror for flaky networks.
Related guides
Go "410 Gone" fetching module from proxy - Fix in CIFix Go "410 Gone" fetching a module from the proxy in CI - a missing version or a transient proxy hiccup. Pin…
Go private module 410/auth failure (GOPRIVATE) - Fix in CIFix Go private module "410 Gone" or auth failures in CI - the proxy/sum DB cannot reach a private repo. Set G…
Go "invalid version" fetching module - Fix in CIFix Go "invalid version: unknown revision" / malformed version in CI - the requested module version is not a…