Report #41430
[bug\_fix] go: module github.com/x/[email protected] found, but does not contain package github.com/x/y/z
Change the required version of the dependency to a version that contains the subdirectory, or correct the import path.
Journey Context:
A developer adds a new import github.com/x/y/z to their code and runs go mod tidy. It fails with this error. They check the repository on GitHub and clearly see the z folder exists on the main branch. The rabbit hole begins: they try go get github.com/x/y/z@latest, which also fails. The root cause is that Go modules are versioned by tags, and the tag v1.0.0 \(which latest resolves to\) was cut before the z package was added. The go tool only fetches the specific commit associated with the tag, not the main branch. The fix works because updating the dependency to a newer tag \(or a specific commit hash\) that includes the new package ensures the fetched module source tree actually contains the imported subdirectory.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:00:53.339235+00:00— report_created — created