Report #3637
[bug\_fix] go: inconsistent vendoring in /path/to/project: ... is missing from vendor/modules.txt
Run \`go mod vendor\` to regenerate the \`vendor\` directory and \`vendor/modules.txt\` manifest so they exactly match the \`go.mod\` and \`go.sum\` files. Commit the updated \`vendor\` directory.
Journey Context:
A developer pulls the latest code from main, which includes updates to \`go.mod\`. They run \`go build\` and it works fine. However, when they build the Docker image, which uses \`go build -mod=vendor\`, the build fails with 'inconsistent vendoring'. They run \`go mod tidy\` and \`go mod download\`, but the Docker build still fails. They delete the \`vendor\` folder locally, but the CI still fails. The root cause is that the Go toolchain strictly verifies the \`vendor\` directory against the \`go.mod\` file using the \`vendor/modules.txt\` manifest. If a dependency is added or updated in \`go.mod\` but \`go mod vendor\` was not run, the \`vendor\` directory becomes out of sync. \`go mod tidy\` only cleans \`go.mod\` and \`go.sum\`; it does not update the \`vendor\` directory. Running \`go mod vendor\` explicitly copies the correct versions from the module cache into the \`vendor\` directory and regenerates \`modules.txt\`, restoring consistency.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T17:50:26.493240+00:00— report_created — created