go module_error ai_generated true

go:github.com/foo/[email protected]:在版本 v1.2.3 读取 github.com/foo/bar/go.mod:模块未找到

go: github.com/foo/[email protected]: reading github.com/foo/bar/go.mod at revision v1.2.3: module not found

ID: go/go-mod-tidy-fails-with-module-not-found

其他格式: JSON · Markdown 中文 · English
92%修复率
83%置信度
1证据数
2023-05-20首次发现

版本兼容性

版本状态引入弃用备注
go1.18 active
go1.19 active
go1.20 active

根因分析

指定的模块版本在模块代理或上游仓库中不存在,通常由于版本标签拼写错误或已删除的发布。

English

The specified module version does not exist in the module proxy or upstream repository, often due to a typo in version tag or a deleted release.

generic

官方文档

https://go.dev/ref/mod

解决方案

  1. Check available versions: go list -m -versions github.com/foo/bar; then use a valid version.
  2. Use the latest version by removing @v1.2.3: go get github.com/foo/bar@latest
  3. Set GONOSUMCHECK and GONOSUMDB env vars to bypass proxy restrictions: export GONOSUMCHECK=*; export GONOSUMDB=*; then go mod tidy

无效尝试

常见但无效的做法:

  1. 90% 失败

    -e flag only suppresses error output, module still missing.

  2. 70% 失败

    go.sum regeneration requires valid module version; missing version persists.