Skip to content
Latchkey

Go "missing go.sum entry for module" - Fix in CI

A build under the default -mod=readonly needs a module whose checksum is not recorded in go.sum. Go will not silently add it, so it stops.

What this error means

A build or test fails with missing go.sum entry for module providing package X; to add it: go mod download X. It usually means go.sum was not committed after a dependency change, or only a partial tidy was run.

go
missing go.sum entry for module providing package github.com/pkg/errors
	(imported by example.com/app); to add it:
	go mod download github.com/pkg/errors

Common causes

go.sum not updated after a new import

A package was imported or a dependency bumped without running go mod tidy, so its checksum was never written to go.sum.

Partial commit of module files

go.mod was committed but go.sum was left out (or vice versa), leaving the checksum file incomplete.

How to fix it

Tidy and commit go.sum

  1. Run go mod tidy to reconcile go.mod and go.sum with the real import graph.
  2. Commit both files together so the readonly build has every checksum it needs.
Terminal
go mod tidy
git add go.mod go.sum
git commit -m "go mod tidy"

Guard tidiness in CI

  1. Run go mod tidy in the pipeline.
  2. Fail if it changes go.mod or go.sum, flagging an uncommitted update.
.github/workflows/ci.yml
go mod tidy
git diff --exit-code go.mod go.sum

How to prevent it

  • Run go mod tidy after every import or dependency change.
  • Always stage go.mod and go.sum together.
  • Add a git diff --exit-code go.mod go.sum guard to CI.

Frequently asked questions

What causes ""missing go.sum entry""?
A package was imported or a dependency bumped without running go mod tidy, so its checksum was never written to go.sum.
How do I fix "missing go.sum entry"?
Tidy and commit go.sum

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card