go module_error ai_generated true

go: 模块 github.com/example/[email protected]: 从 https://proxy.golang.org 读取时返回 404

go: module github.com/example/[email protected]: reading https://proxy.golang.org/github.com/example/lib/@v/v1.0.0.mod: 404 Not Found

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

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
1.21 active
1.22 active
1.23 active

根因分析

模块版本在 Go 模块代理上不存在,通常是因为模块路径拼写错误或版本标签未推送。

English

The module version does not exist on the Go module proxy, usually due to a typo in the module path or version tag not being pushed.

generic

解决方案

  1. 85% 成功率 Verify the module path and version exist on the proxy or source repository.
    Run 'go list -m -versions github.com/example/lib' to see available versions. Check the repo tags.
  2. 75% 成功率 Use a direct source path with GOFLAGS=-mod=mod and replace directive.
    In go.mod, add: 'replace github.com/example/lib v1.0.0 => github.com/example/lib v1.0.1' (if version exists) or use a fork.

无效尝试

常见但无效的做法:

  1. Using 'go get -u' to force update all modules. 90% 失败

    The targeted version doesn't exist, so updating won't fix the 404.

  2. Adding the module path to go.sum manually. 100% 失败

    go.sum only stores checksums; it doesn't create module versions.