go build_error ai_generated true

go: inconsistent vendoring: vendor directory is missing, but -mod=vendor is set. Run 'go mod vendor'.

ID: go/vendor-directory-not-present

Also available as: JSON · Markdown · 中文
80%Fix Rate
86%Confidence
0Evidence
2024-06-02First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.14 active
1.20 active

Root Cause

The project is configured to use vendoring (via -mod=vendor or GOFLAGS), but the vendor directory doesn't exist.

generic

中文

项目配置为使用 vendoring(通过 -mod=vendor 或 GOFLAGS),但 vendor 目录不存在。

Workarounds

  1. 95% success
    go mod vendor
  2. 80% success
    go build -mod=mod

Dead Ends

Common approaches that don't work:

  1. 100% fail

    Go expects specific files like modules.txt; empty dirs won't satisfy the build.

  2. 50% fail

    You may not control the build environment; the flag may be set in CI.