go config_error ai_generated true

go: cannot find module providing package github.com/foo/bar: module lookup disabled by GOPROXY=off

ID: go/go-mod-vendor-permission-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2024-11-10First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
1.13 active

Root Cause

When GOPROXY=off and the module is not in the vendor directory, the go command cannot resolve the package.

generic

中文

当 GOPROXY=off 且模块不在 vendor 目录中时,go 命令无法解析该包。

Workarounds

  1. 90% success
    Set GOPROXY to a valid proxy or direct, then run 'go mod download' or 'go mod vendor'.
  2. 60% success
    If offline, ensure the module is already in the module cache: 'go env GOMODCACHE' and copy from another machine.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    GOPROXY=off overrides this flag; module downloads are still blocked.

  2. 70% fail

    This is not compatible with module mode and can cause import path mismatches.