Skip to content
Latchkey

Go "cannot find module providing package" - Fix in CI

Go found an import in your code but no module in go.mod provides it. Without a require directive it cannot resolve where the package comes from.

What this error means

A build fails with no required module provides package X; to add it: go get X or cannot find module providing package X. It means an import was added without recording the dependency.

go
app/main.go:6:2: no required module provides package github.com/google/uuid;
	to add it:
	go get github.com/google/uuid

Common causes

Import added without a require

New code imports a package, but go get/go mod tidy was never run to add the providing module to go.mod.

Typo in the import path

The import path is misspelled, so no real module matches and Go reports it as unprovided.

How to fix it

Add the missing module

  1. Run go get for the package, or go mod tidy to resolve all imports at once.
  2. Commit the updated go.mod and go.sum.
Terminal
go mod tidy
git add go.mod go.sum
git commit -m "add missing dependency"

Verify the import path

  1. Confirm the import path matches the real module path on the source host.
  2. Fix typos, then rebuild.
Terminal
go build ./...

How to prevent it

  • Run go mod tidy after adding any import.
  • Copy import paths from the package docs to avoid typos.
  • Add a tidiness guard to CI so missing requires fail early.

Frequently asked questions

What causes ""cannot find module providing package""?
New code imports a package, but go get/go mod tidy was never run to add the providing module to go.mod.
How do I fix "cannot find module providing package"?
Add the missing module

Related guides

References

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