{"record":{"id":"c968b8a69b96680b","repo":"hashicorp/nomad","slug":"version-must-be-zero-when-tagging-latest-got-d","errorCode":null,"errorMessage":"version must be zero when tagging latest, got: %d","messagePattern":"version must be zero when tagging latest, got: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":2406,"sourceCode":"\tj.srv.MeasureRPCRate(\"job\", structs.RateMetricWrite, args)\n\tif authErr != nil {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"job\", \"tag_version\"}, time.Now())\n\n\taclObj, err := j.srv.ResolveACL(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !aclObj.AllowNsOpAnyOf(args.RequestNamespace(),\n\t\tacl.NamespaceCapabilitySubmitJob,\n\t\tacl.NamespaceCapabilityTagJobVersion,\n\t) {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\n\tif args.Latest && args.Version > 0 {\n\t\treturn fmt.Errorf(\"version must be zero when tagging latest, got: %d\", args.Version)\n\t}\n\tif args.Tag != nil {\n\t\targs.Tag.TaggedTime = time.Now().UnixNano()\n\t}\n\n\t_, index, err := j.srv.raftApply(structs.JobVersionTagRequestType, args)\n\tif err != nil {\n\t\tj.logger.Error(\"tagging version failed\", \"error\", err)\n\t\treturn err\n\t}\n\n\treply.Index = index\n\tif args.Tag != nil {\n\t\treply.Name = args.Tag.Name\n\t\treply.Description = args.Tag.Description\n\t\treply.TaggedTime = args.Tag.TaggedTime\n\t}\n","sourceCodeStart":2388,"sourceCodeEnd":2424,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L2388-L2424","documentation":"Guard in Job.TagVersion: the request sets both Latest and an explicit Version; tagging the latest version requires Version to be zero so the two selectors are not contradictory.","triggerScenarios":"Thrown at nomad/job_endpoint.go:2406 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set either latest=true with version 0, or an explicit version without latest"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}