Skip to content
Latchkey

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 timeout

Common 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

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

Cache the module cache

  1. 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/mod keyed on go.sum.
  • Add a bounded retry around module downloads.
  • Consider a closer module mirror for flaky networks.

Related guides

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