Report #10521
[bug\_fix] go: module github.com/example/project found, but does not contain package github.com/example/project/subpkg
Verify the sub-package directory exists in the target repository at the requested version tag. If the dependency's go.mod declares a different module path, update the import to match the declared module path.
Journey Context:
A developer adds a new import for a sub-package of a third-party library and runs go build. The build fails with this error. The developer checks GitHub and sees the subpkg directory exists on the main branch. Confused, they inspect the dependency's go.mod file and realize the module path is github.com/example/old-project, meaning the import should be github.com/example/old-project/subpkg. Alternatively, they realize the subpkg was added after the latest tagged release, so go get fetches the latest tag where the directory doesn't exist yet. Updating the import path to match the go.mod declaration or explicitly requesting a newer, untagged commit via go get github.com/example/project@ resolves the issue.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T10:54:06.208736+00:00— report_created — created