Skip to content
Latchkey

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.

go
app/main.go:7:2: module github.com/foo/bar@latest found (v1.4.0), but does not contain package github.com/foo/bar/utils

Common 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

  1. Correct the subpackage path against the module docs.
  2. Or pin a version where the package still exists, then tidy.
Terminal
go get github.com/foo/bar@v1.3.0
go mod tidy

List the package contents

  1. Inspect what the resolved version actually provides.
Terminal
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.

Frequently asked questions

What causes ""module found, no package""?
The package existed in an older version but was renamed or deleted in the resolved one.
How do I fix "module found, no package"?
Fix the import path or pin a version that has it

Related guides

References

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