Report #4759
[bug\_fix] go: inconsistent vendoring in /path/to/project: ... \(missing from vendor directory\)
Run go mod vendor to synchronize the vendor directory with the go.mod file, then commit the updated vendor directory. The Go toolchain detects that the vendor directory is out of sync with the module definitions and blocks the build to prevent using stale or missing dependencies.
Journey Context:
A developer adds a new dependency using go get, which updates go.mod and go.sum. They run go build and it fails, complaining about inconsistent vendoring and missing packages from the vendor directory. They check their imports, which are correct. They might try manually copying the package into the vendor folder or deleting the vendor folder entirely to bypass the error. The rabbit-hole stems from the strict verification introduced in Go 1.14, where the vendor directory is checked for consistency against go.mod. If go.mod specifies a dependency that isn't in vendor, or if versions mismatch, the build fails. The fix is simply to run go mod vendor to repopulate the directory with the exact dependencies listed in go.mod, ensuring the vendored source matches the module graph.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:01:42.526724+00:00— report_created — created