go
module_error
ai_generated
true
go: github.com/foo/[email protected]: reading github.com/foo/bar/go.mod at revision v1.2.3: unknown revision v1.2.3
ID: go/go-mod-tidy-wrong-version
85%Fix Rate
85%Confidence
1Evidence
2024-01-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| go1.21 | active | — | — | — |
| go1.22 | active | — | — | — |
| go1.23 | active | — | — | — |
Root Cause
The requested module version does not exist in the remote repository, often due to a typo, tag mismatch, or missing tag.
generic中文
请求的模块版本在远程仓库中不存在,通常是由于拼写错误、标签不匹配或标签缺失。
Official Documentation
https://go.dev/ref/mod#go-mod-tidyWorkarounds
-
90% success 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.
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.
-
85% success Use 'go list -m -versions github.com/foo/bar' to list all available versions and choose a valid one.
Use 'go list -m -versions github.com/foo/bar' to list all available versions and choose a valid one.
中文步骤
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.
Use 'go list -m -versions github.com/foo/bar' to list all available versions and choose a valid one.
Dead Ends
Common approaches that don't work:
-
Running 'go clean -modcache' and retrying.
95% fail
The cache is not the issue; the version truly doesn't exist in the remote repo.
-
Adding a replace directive in go.mod pointing to a local path.
60% fail
This only works if the local path contains the correct code; it doesn't fix the remote version mismatch.