Report #22966
[bug\_fix] go: module github.com/example/[email protected] found, but does not contain package github.com/example/module/pkg/subpkg
Check the import path for typos, verify the package actually exists at that path in the specified version, or update the module version in go.mod to a version that includes the package.
Journey Context:
A developer adds a new import \`github.com/example/module/pkg/subpkg\` to their code and runs \`go mod tidy\`. The command fails, stating the module is found but the package is not. The developer checks the repository on GitHub and clearly sees the \`pkg/subpkg\` directory exists. They go down a rabbit hole of clearing the module cache, checking their \`GOPROXY\` settings, and wondering if the git tag is broken. The actual root cause is that the \`go.mod\` file in their project is pinned to an older version of \`github.com/example/module\` \(e.g., \`v1.0.0\`\) where \`pkg/subpkg\` did not exist yet, or the developer added the import without updating the required version. The Go toolchain resolves the module version \*first\* from \`go.mod\`, and only looks for the package within that specific version. The fix works because updating the version in \`go.mod\` \(e.g., \`go get github.com/example/module@latest\`\) pulls the version that actually contains the desired package.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:57:18.214710+00:00— report_created — created