golang/go · error
preceding tag (%s) not found
Error message
preceding tag (%s) not found
What it means
validatePseudoVersion (coderepo.go:765-785) calls r.code.Tags(ctx, tagPrefix+base) to enumerate tags matching the base version and walks them. If none of the returned tags has a version equal to base, lastTag stays empty and this error fires: the pseudo-version claims a preceding tag (its base) that does not exist anywhere in the repo.
Source
Thrown at src/cmd/go/internal/modfetch/coderepo.go:784
if err != nil {
return err
}
var lastTag string // Prefer to log some real tag rather than a canonically-equivalent base.
ancestorFound := false
for _, tag := range tags.List {
versionOnly := strings.TrimPrefix(tag.Name, tagPrefix)
if semver.Compare(versionOnly, base) == 0 {
lastTag = tag.Name
ancestorFound, err = r.code.DescendsFrom(ctx, info.Name, tag.Name)
if ancestorFound {
break
}
}
}
if lastTag == "" {
return fmt.Errorf("preceding tag (%s) not found", base)
}
if !ancestorFound {
if err != nil {
return err
}
rev, err := module.PseudoVersionRev(version)
if err != nil {
return fmt.Errorf("not a descendent of preceding tag (%s)", lastTag)
}
return fmt.Errorf("revision %s is not a descendent of preceding tag (%s)", rev, lastTag)
}
return nil
}
func (r *codeRepo) revToRev(rev string) string {
if semver.IsValid(rev) {
if module.IsPseudoVersion(rev) {View on GitHub (pinned to b6b368adc5)
Solutions
- Verify the base tag exists: `git tag --list '<tagPrefix>v1.2.3*'` in the source repo.
- Re-derive the pseudo-version from the real nearest ancestor tag (`go get <module>@<commit>`).
- If you own the repo, restore or recreate the missing tag.
- For subdirectory modules, confirm the tag prefix matches the module path major subdirectory.
Example fix
// before (base v1.2.3 never tagged) require example.com/m v1.2.4-0.20240101120000-e3702bed3d42 // after (base on a real ancestor tag) require example.com/m v1.2.3-0.20240101120000-e3702bed3d42 // if v1.2.3 exists // or pin to the real tag require example.com/m v1.2.3
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the base tag exists before referencing a pseudo-version. // bash: // git tag --list '<tagPrefix>v1.2.3*' // # if empty, the base does not exist; re-derive or recreate the tag // // Go: re-derive via tooling // go get example.com/m@<commit> // picks the highest real ancestor tag as base
Prevention
- Never delete upstream tags that old pseudo-versions reference.
- Use `go get @<commit>` so the tool finds a real ancestor tag.
- For subdirectory modules, ensure tags are namespaced under the module path.
When it happens
Trigger: A pseudo-version embeds a base like v1.2.3 but the repo never had a v1.2.3 tag (e.g. it was deleted, or the base was fabricated). The tag-prefix lookup (for subdirectory modules, e.g. foo/v1.2.3) also fails.
Common situations: Upstream deleted a tag that older pseudo-versions referenced; pseudo-version was hand-built with an invented base; tags exist only under a different prefix (subdirectory module path mismatch).
Related errors
- not a descendent of preceding tag (%s)
- resolves to version %v (%s is not a tag)
- revision is longer than canonical (expected %s)
- revision is shorter than canonical (expected %s)
- does not match version-control timestamp (expected %s)
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/8c161b42807a8e15.
Report an issue: GitHub.