Report #104573
[bug\_fix] cannot find module providing package : import lookup disabled by -mod=vendor
Run \`go mod vendor\` to populate the vendor directory with all required modules, or build without \`-mod=vendor\` \(e.g., \`go build -mod=mod\`\). Ensure that the vendor directory is not stale by running \`go mod vendor\` after any dependency change.
Journey Context:
A team used vendoring to manage dependencies in a CI environment without network access. After a developer added a new dependency using \`go get\`, they committed the updated go.mod and go.sum but forgot to run \`go mod vendor\`. The CI build failed with: \`cannot find module providing package github.com/new/dep: import lookup disabled by -mod=vendor\`. The developer checked the vendor directory and saw the new package was missing. They assumed that \`go build\` would automatically detect the new dependency and download it, but because \`-mod=vendor\` was set \(either via GOFLAGS or a Makefile\), Go only looked in the vendor directory and did not fall back to the module cache or network. The root cause: \`-mod=vendor\` forces Go to use only the vendored copies; if the vendor directory is incomplete, build fails. The fix was to run \`go mod vendor\` on the developer's machine and commit the updated vendor directory. The team added a CI step to verify that \`go mod vendor\` is up to date by running \`go mod verify\` or comparing the vendor directory with go.mod.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-06T20:07:10.497482+00:00— report_created — created