Go: go: updates to go.mod needed; to update it: go mod tidy
go.mod is out of sync with the imports in your code, and Go is running with -mod=readonly (the default).
go: updates to go.mod neededgo: updates to go.mod needed; to update it: go mod tidygo: inconsistent vendoringgo.mod requires go >= 1.22 (running go 1.21)go: go.mod file indicates go 1.22, but maximum supported version is Meaning
Run go mod tidy to add missing requirements and drop unused ones, then commit go.mod and go.sum. In CI use go mod tidy && git diff --exit-code to enforce it. The same message appears when a required Go version in go.mod is newer than your toolchain.
Common causes
- Imports added without
go get - go.mod edited by hand
- Dependency upgraded in another branch
- go.mod
godirective newer than installed Go - Vendor mode mismatch
⚡ Quick fix
go mod tidyand commit both files- Upgrade the Go toolchain when
go.modrequires a newer version - Use
go mod vendoronly if you use-mod=vendor
Detailed fix by platform
Go
go mod tidy && go mod verify
How to diagnose
- Imports — New since go.mod last tidied?
- Version — go directive vs toolchain?
- Files — go.sum committed?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- cannot find package in any of GOROOT / GOPATH Go: cannot find package "github.com/pkg/errors" in any of: /usr/local/go/src/github.com/pkg/errors (from $GOROOT) /go/src/github.com/pkg/errors (from $GOPATH)
- invalid version: unknown revision Go: go: github.com/foo/bar@v1.2.3: invalid version: unknown revision v1.2.3
- listen tcp :8080: bind: address already in use Go: listen tcp :8080: bind: address already in use
Most viewed in Go
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026