go
module_error
ai_generated
true
go: updates to go.sum needed, disabled by -mod=readonly; to update run: go mod tidy
ID: go/mod-tidy-missing-go-sum
92%Fix Rate
92%Confidence
120Evidence
2021-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 122 | active | — | — | — |
Root Cause
The go.sum file is missing entries needed for the current dependencies. Go modules require go.sum to verify dependency integrity. Running go mod tidy updates both go.mod and go.sum.
genericWorkarounds
-
95% success Run go mod tidy to update go.mod and go.sum
go mod tidy # This adds missing entries and removes unused ones from go.sum # Commit both go.mod and go.sum
Sources: https://go.dev/ref/mod#go-mod-tidy
-
90% success In CI, ensure go.sum is committed and up-to-date
# Add to CI pipeline: go mod tidy git diff --exit-code go.mod go.sum # This fails the build if go.sum is out of date
Sources: https://go.dev/ref/mod#go-mod-tidy
Dead Ends
Common approaches that don't work:
-
Deleting go.sum and regenerating from scratch
55% fail
While this works in isolation, it changes checksums for all dependencies, making the diff noisy and potentially introducing different versions than intended.
-
Using GONOSUMCHECK to skip checksum verification
75% fail
Disables security verification of downloaded modules. Supply chain attacks become possible. Not a fix, just hiding the problem.
Error Chain
Frequently confused with: