Report #24781
[bug\_fix] go: inconsistent vendoring in /path/to/project: ... is missing from vendor/ or go: main module does not contain package ...
Run go mod vendor to regenerate the vendor directory so it matches the current go.mod and go.sum files.
Journey Context:
A developer adds a new third-party package to their code using go get and writes code that imports it. When they run go build, it fails, claiming the package is missing or that vendoring is inconsistent. They check go.mod and see the dependency clearly listed. The rabbit hole: they check their import paths, verify the module exists, and even try clearing the module cache. The root cause is that their project contains a vendor/ directory. Since Go 1.14, if a vendor directory is present, the go command defaults to using it \(-mod=vendor\). The go get command updated go.mod but did not update the vendor/ directory. The build fails because the imported package isn't physically inside the stale vendor/ folder. Running go mod vendor re-populates the directory with the exact dependencies listed in go.mod, fixing the build.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T20:00:29.818753+00:00— report_created — created