go module_error ai_generated true

go: module github.com/user/[email protected]: reading https://proxy.golang.org/github.com/user/private-repo/@v/v1.0.0.info: 404 Not Found

ID: go/module-not-found-in-go-path

Also available as: JSON · Markdown · 中文
85%Fix Rate
84%Confidence
1Evidence
2024-06-12First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
go1.17 active
go1.18 active
go1.19 active
go1.20 active
go1.21 active

Root Cause

Go proxy (proxy.golang.org) cannot find the module version, either because the module is private and not accessible via the default proxy, or the version tag does not exist in the repository.

generic

中文

Go 代理 (proxy.golang.org) 找不到该模块版本,可能是因为模块是私有的且无法通过默认代理访问,或者版本标签在仓库中不存在。

Official Documentation

https://go.dev/ref/mod#private-modules

Workarounds

  1. 85% success Set GONOSUMCHECK and GONOSUMDB, then use `GONOSUMCHECK=* GONOSUMDB=* GOPROXY=direct go get github.com/user/[email protected]` to bypass the proxy entirely.
    Set GONOSUMCHECK and GONOSUMDB, then use `GONOSUMCHECK=* GONOSUMDB=* GOPROXY=direct go get github.com/user/[email protected]` to bypass the proxy entirely.
  2. 90% success If the repo is private, configure git with a personal access token: `git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"` then set `GOPRIVATE=github.com/user/private-repo`.
    If the repo is private, configure git with a personal access token: `git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"` then set `GOPRIVATE=github.com/user/private-repo`.

中文步骤

  1. Set GONOSUMCHECK and GONOSUMDB, then use `GONOSUMCHECK=* GONOSUMDB=* GOPROXY=direct go get github.com/user/[email protected]` to bypass the proxy entirely.
  2. If the repo is private, configure git with a personal access token: `git config --global url."https://${GITHUB_TOKEN}:[email protected]/".insteadOf "https://github.com/"` then set `GOPRIVATE=github.com/user/private-repo`.

Dead Ends

Common approaches that don't work:

  1. 90% fail

    Tidy doesn't bypass proxy; it still queries the same proxy URL which returns 404.

  2. 50% fail

    The error is about module retrieval (404), not checksum verification.