# go: 模块 github.com/example/lib@v1.0.0: 从 https://proxy.golang.org 读取时返回 404

- **ID:** `go/module-not-found-in-proxy`
- **领域:** go
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.21 | active | — | — |
| 1.22 | active | — | — |
| 1.23 | active | — | — |

## 解决方案

1. **Verify the module path and version exist on the proxy or source repository.** (85% 成功率)
   ```
   Run 'go list -m -versions github.com/example/lib' to see available versions. Check the repo tags.
   ```
2. **Use a direct source path with GOFLAGS=-mod=mod and replace directive.** (75% 成功率)
   ```
   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.
   ```

## 无效尝试

- **Using 'go get -u' to force update all modules.** — The targeted version doesn't exist, so updating won't fix the 404. (90% 失败率)
- **Adding the module path to go.sum manually.** — go.sum only stores checksums; it doesn't create module versions. (100% 失败率)
