Report #15219
[bug\_fix] go: module github.com/user/[email protected] found, but does not contain package github.com/user/repo/pkg/subpkg
Update the required module version to a commit or tag that actually contains the package, or correct the import path.
Journey Context:
A developer wants to use a new sub-package from a popular library. They add the import \`github.com/user/repo/v2/pkg/subpkg\` to their code and run \`go mod tidy\`. It fails, stating the module is found but doesn't contain the package. The developer checks GitHub and clearly sees the \`subpkg\` directory on the \`main\` branch. They might try \`go get github.com/user/repo@master\`, which works, but they want a stable release. The root cause is that the Go module system resolves dependencies to the latest semver tag \(\`v2.0.0\`\), which was created before the \`subpkg\` was added. The Go toolchain only downloads the code at the specific tagged version, not the latest commit on the default branch. The fix is to explicitly request a newer commit that contains the package, e.g., \`go get github.com/user/repo@abc123\`, or wait for the maintainers to tag a new release that includes the sub-package.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T23:26:29.155592+00:00— report_created — created