# go：github.com/foo/bar@v1.2.3：读取修订版本 v1.2.3 的 go.mod 时出错：未知修订版本 v1.2.3

- **ID:** `go/go-mod-tidy-wrong-version`
- **领域:** go
- **类别:** module_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

请求的模块版本在远程仓库中不存在，通常是由于拼写错误、标签不匹配或标签缺失。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| go1.21 | active | — | — |
| go1.22 | active | — | — |
| go1.23 | active | — | — |

## 解决方案

1. ```
   Verify the tag exists in the remote repository using 'git ls-remote --tags https://github.com/foo/bar' and correct the version in go.mod.
   ```
2. ```
   Use 'go list -m -versions github.com/foo/bar' to list all available versions and choose a valid one.
   ```

## 无效尝试

- **Running 'go clean -modcache' and retrying.** — The cache is not the issue; the version truly doesn't exist in the remote repo. (95% 失败率)
- **Adding a replace directive in go.mod pointing to a local path.** — This only works if the local path contains the correct code; it doesn't fix the remote version mismatch. (60% 失败率)
