{"record":{"id":"758133650e4bb78a","repo":"dagger/dagger","slug":"invalid-git-latest-tag-q-not-a-semantic-version","errorCode":null,"errorMessage":"invalid git-latest tag %q: not a semantic version","messagePattern":"invalid git-latest tag %q: not a semantic version","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/git.go","lineNumber":180,"sourceCode":"\t\treturn \"\", nil\n\t}\n\treturn refs[selected.Name], nil\n}\n\n// ValidateGitLatestRef validates a ref selected by git-latest.\nfunc ValidateGitLatestRef(refName string, tagPrefix string) error {\n\tif tag, ok := strings.CutPrefix(refName, \"refs/tags/\"); ok {\n\t\tversion := tag\n\t\ttagPrefix = strings.Trim(tagPrefix, \"/\")\n\t\tif tagPrefix != \"\" {\n\t\t\tversion, _ = strings.CutPrefix(version, tagPrefix+\"/\")\n\t\t}\n\t\tparsed, ok := parseReleaseTag(releaseTagCandidate{\n\t\t\tName:    tag,\n\t\t\tVersion: version,\n\t\t})\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"invalid git-latest tag %q: not a semantic version\", tag)\n\t\t}\n\t\tif parsed.Semver.Prerelease != \"\" {\n\t\t\treturn fmt.Errorf(\"invalid git-latest tag %q: prerelease tags are not supported\", tag)\n\t\t}\n\t\treturn nil\n\t}\n\n\tif branch, ok := strings.CutPrefix(refName, \"refs/heads/\"); ok && branch != \"\" {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"invalid git-latest ref %q\", refName)\n}\n\nvar _ dagql.PersistedObject = (*GitRepository)(nil)\nvar _ dagql.PersistedObjectDecoder = (*GitRepository)(nil)\nvar _ dagql.OnReleaser = (*GitRepository)(nil)\nvar _ dagql.HasDependencyResults = (*GitRepository)(nil)\nvar _ dagql.PersistedObject = (*GitRef)(nil)","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/dagger/dagger/blob/82ba2681dbe30d3547a1dc50ea495900ab5b6047/core/git.go#L162-L198","documentation":"This error is returned by ValidateGitLatestRef when the ref is a tag but its version portion is not a valid semantic version. The library throws it because the git-latest machinery requires the latest ref to be a clean semver release tag so it can compare and validate releases.","triggerScenarios":"Calling ValidateGitLatestRef with a tag ref (refs/tags/<name>) where parsing parseReleaseTag fails — e.g. tags like v1.2, release-2024, or v01.2.3 with malformed formatting.","commonSituations":"Repositories using non-semver tagging conventions; tag typos; a tag prefix matched but the remaining version string isn't semver (e.g. v1.2.3.4).","solutions":["Retag with a valid semantic version, e.g. v1.2.3 instead of v1.2","Point the latest ref at an existing valid semver release tag","Adjust the tag prefix so it only matches semver release tags","Strip or rename legacy non-semver tags if they must not be selected"],"exampleFix":"// before\ngit tag v1.2\n// after\ngit tag v1.2.0 && git push origin v1.2.0","handlingStrategy":"validation","validationCode":"func isStableSemverTag(tag string) bool {\n    v, err := semver.StrictNewVersion(strings.TrimPrefix(tag, \"v\"))\n    return err == nil && v.String() != \"\"\n}\nif !isStableSemverTag(candidate) { skip() }","typeGuard":"func looksLikeSemver(s string) bool {\n    _, err := semver.NewVersion(s)\n    return err == nil\n}","tryCatchPattern":"if err := ValidateGitLatestRef(ctx, repo, ref); err != nil {\n    if strings.Contains(err.Error(), \"not a semantic version\") {\n        return nil, fmt.Errorf(\"latest ref must be a semver tag like v1.2.3; got %s\", ref)\n    }\n    return err\n}","preventionTips":["Adopt strict semver (MAJOR.MINOR.PATCH) tagging conventions","Validate tags in CI before pushing","Avoid tags like v1.2 or v1.2.3.4","Document the tag prefix and format expected by git-latest"],"tags":["git","semver","validation","tags"],"backgroundTag":"invalid-semver-tag","analyzedSha":"82ba2681dbe30d3547a1dc50ea495900ab5b6047","analyzedAt":"2026-09-05T07:21:37.930Z","contentChangedAt":"2026-09-05T07:21:37.930Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}