Go "reading X: 404/410 Not Found" fetching module - Fix in CI
A 404 or 410 from the module proxy means it will not serve that path. It is either a version that truly does not exist or a transient proxy failure that clears on retry.
What this error means
A fetch fails with reading https://proxy.golang.org/.../@v/vX.Y.Z.info: 404 Not Found (or 410 Gone). A reproducible code is a missing version; an intermittent one is a transient proxy blip.
go: github.com/foo/bar@v1.5.0: reading https://proxy.golang.org/github.com/foo/bar/@v/v1.5.0.info: 404 Not Found
server response: not found: github.com/foo/bar@v1.5.0: invalid version: unknown revision v1.5.0Common causes
Version does not exist upstream
A tag was deleted or never published, so the proxy has nothing to serve - a deterministic 404/410.
Transient proxy failure
The proxy momentarily returned 404/410 for a path that does resolve on retry.
How to fix it
Pin a version that exists
- List available versions and require one that actually exists.
- Run go mod tidy and commit.
go list -m -versions github.com/foo/bar
go get github.com/foo/bar@v1.5.1
go mod tidyRetry a transient code
- Re-run the fetch; transient 404/410s usually clear immediately.
for i in 1 2 3; do go mod download && break; sleep 5; doneHow to prevent it
- Pin exact, published versions and avoid deleted tags.
- Cache the module cache so resolved versions are reused.
- Add a bounded retry around downloads for transient proxy errors.