{"record":{"id":"79433d68aff545bc","repo":"hashicorp/nomad","slug":"version-tag-s-not-found-for-job-s","errorCode":null,"errorMessage":"version tag %s not found for job %s","messagePattern":"version tag (.+?) not found for job (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/jobs.go","lineNumber":288,"sourceCode":"\t}\n\treturn j.VersionsOpts(jobID, opts, q)\n}\n\n// VersionByTag is used to retrieve a job version by its VersionTag name.\nfunc (j *Jobs) VersionByTag(jobID, tag string, q *QueryOptions) (*Job, *QueryMeta, error) {\n\tversions, _, qm, err := j.Versions(jobID, false, q)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Find the version with the matching tag\n\tfor _, version := range versions {\n\t\tif version.VersionTag != nil && version.VersionTag.Name == tag {\n\t\t\treturn version, qm, nil\n\t\t}\n\t}\n\n\treturn nil, nil, fmt.Errorf(\"version tag %s not found for job %s\", tag, jobID)\n}\n\ntype VersionsOptions struct {\n\tDiffs       bool\n\tDiffTag     string\n\tDiffVersion *uint64\n}\n\nfunc (j *Jobs) VersionsOpts(jobID string, opts *VersionsOptions, q *QueryOptions) ([]*Job, []*JobDiff, *QueryMeta, error) {\n\tvar resp JobVersionsResponse\n\n\tqp := url.Values{}\n\tif opts != nil {\n\t\tqp.Add(\"diffs\", strconv.FormatBool(opts.Diffs))\n\t\tif opts.DiffTag != \"\" {\n\t\t\tqp.Add(\"diff_tag\", opts.DiffTag)\n\t\t}\n\t\tif opts.DiffVersion != nil {","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/api/jobs.go#L270-L306","documentation":"VersionByTag iterates a job's versions looking for one whose VersionTag.Name matches the requested tag. If no tagged version matches after scanning all versions, it returns this error with the tag and jobID. It is a lookup miss, not a transport failure.","triggerScenarios":"Calling jobs.VersionByTag(jobID, tag, q) (or VersionByTagOnUpdate) where the job has no version tagged with that name — tag was never set, was overwritten, or the jobID is wrong.","commonSituations":"Typos in tag names; deployment tooling referencing a tag before tagging the job; tags lost after a job purge/rewrite; case sensitivity mismatch.","solutions":["List job versions (jobs.Versions) and verify the tag exists","Re-tag the correct version (nomad job tag or Jobs.TagVersion API)","Check jobID spelling and namespace","Fix tooling to create the tag before consumers query it"],"exampleFix":"// before\n_, _, err := jobs.VersionByTag(\"web\", \"stable\", nil) // tag never set\n// after\njobs.TagVersion(\"web\", &structs.VersionTag{Name: \"stable\"}, nil, nil)\n_, _, err := jobs.VersionByTag(\"web\", \"stable\", nil)","handlingStrategy":"type-guard","validationCode":"versions, _, _ := jobs.Versions(jobID, false, nil, nil)\nfor _, v := range versions {\n    if v.VersionTag != nil && v.VersionTag.Name == tag {\n        // safe to call VersionByTag\n    }\n}","typeGuard":"func hasVersionTag(versions []*api.JobVersionsResponse, tag string) bool {\n    for _, v := range versions {\n        if v.VersionTag != nil && v.VersionTag.Name == tag {\n            return true\n        }\n    }\n    return false\n}","tryCatchPattern":"v, _, err := jobs.VersionByTag(jobID, tag, nil)\nif err != nil {\n    if strings.Contains(err.Error(), \"not found\") {\n        return nil // treat as missing tag, not fatal\n    }\n    return err\n}","preventionTips":["Tag versions before other systems depend on them","Validate tag names against jobs.Versions output","Handle tag-not-found as an expected recovery path in deploy tooling"],"tags":["lookup-miss","jobs","versioning"],"backgroundTag":"resource-not-found","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}