Go "module X found, but does not contain package" - Fix in CI
Go resolved the module but the specific package path inside it does not exist at the selected version. The module is real; the subpackage import is wrong, moved, or version-specific.
What this error means
A build fails with module X found (vY.Z), but does not contain package X/sub. It usually means a subpackage was renamed or removed in the pinned version, or the import path has an extra/missing segment.
app/main.go:7:2: module github.com/foo/bar@latest found (v1.4.0), but does not contain package github.com/foo/bar/utilsCommon causes
Subpackage moved or removed
The package existed in an older version but was renamed or deleted in the resolved one.
Wrong import subpath
The import path has an extra or missing segment, so it points at a non-existent package.
How to fix it
Fix the import path or pin a version that has it
- Correct the subpackage path against the module docs.
- Or pin a version where the package still exists, then tidy.
go get github.com/foo/bar@v1.3.0
go mod tidyList the package contents
- Inspect what the resolved version actually provides.
go list github.com/foo/bar/...How to prevent it
- Check release notes before bumping a dependency major version.
- Verify subpackage paths against the module docs.
- Pin versions that still ship the packages you import.