{"record":{"id":"518ae34b47ef3993","repo":"hashicorp/nomad","slug":"can-t-evaluate-parameterized-job","errorCode":null,"errorMessage":"can't evaluate parameterized job","messagePattern":"can't evaluate parameterized job","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":720,"sourceCode":"\n\t// Lookup the job\n\tsnap, err := j.srv.fsm.State().Snapshot()\n\tif err != nil {\n\t\treturn err\n\t}\n\tws := memdb.NewWatchSet()\n\tjob, err := snap.JobByID(ws, args.RequestNamespace(), args.JobID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif job == nil {\n\t\treturn fmt.Errorf(\"job not found\")\n\t}\n\n\tif job.IsPeriodic() {\n\t\treturn fmt.Errorf(\"can't evaluate periodic job\")\n\t} else if job.IsParameterized() {\n\t\treturn fmt.Errorf(\"can't evaluate parameterized job\")\n\t}\n\n\tforceRescheduleAllocs := make(map[string]*structs.DesiredTransition)\n\n\tif args.EvalOptions.ForceReschedule {\n\t\t// Find any failed allocs that could be force rescheduled\n\t\tallocs, err := snap.AllocsByJob(ws, args.RequestNamespace(), args.JobID, false)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, alloc := range allocs {\n\t\t\ttaskGroup := job.LookupTaskGroup(alloc.TaskGroup)\n\t\t\t// Forcing rescheduling is only allowed if task group has rescheduling enabled\n\t\t\tif taskGroup == nil || !taskGroup.ReschedulePolicy.Enabled() {\n\t\t\t\tcontinue\n\t\t\t}\n","sourceCodeStart":702,"sourceCodeEnd":738,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L702-L738","documentation":"The Job.Evaluate RPC refuses to force an evaluation on a parameterized job. Parameterized jobs are templates dispatched manually with inputs; the parent has no running allocations to reschedule, so Nomad rejects evaluation of it via job.IsParameterized().","triggerScenarios":"POST /v1/job/<id>/evaluate with the ID of a job defined with a 'parameterized' block, e.g. calling Evaluate on the template instead of dispatching a child instance.","commonSituations":"Bulk scripts evaluating all jobs in a namespace and hitting parameterized templates; operators attempting to force-reschedule allocations of the parent, which owns none; mistaking the template for a dispatched child job.","solutions":["Dispatch a child instead: POST /v1/job/<id>/dispatch (nomad job dispatch <id>)","Evaluate the dispatched child job ID (e.g. <template>/dispatch-<timestamp>)","Exclude parameterized jobs in bulk automation (check job.ParameterizedJob client-side)","Force-reschedule the child job's allocations with EvalOptions.ForceReschedule on the child"],"exampleFix":"// before\nclient.Jobs().Evaluate(\"batch-template\", nil)\n// after\nclient.Jobs().Dispatch(\"batch-template\", nil, nil, false, nil)","handlingStrategy":"validation","validationCode":"job, _, err := client.Jobs().Info(jobID, nil)\nif err != nil { return err }\nif job.ParameterizedJob != nil {\n\treturn fmt.Errorf(\"%s is parameterized; dispatch instead\", jobID)\n}","typeGuard":"func isParameterizedTemplate(j *api.Job) bool { return j != nil && j.ParameterizedJob != nil }","tryCatchPattern":"if _, _, err := client.Jobs().Evaluate(jobID, nil); err != nil && strings.Contains(err.Error(), \"parameterized\") {\n\t_, _, err = client.Jobs().Dispatch(jobID, nil, nil, false, nil)\n}","preventionTips":["Use Jobs().Dispatch for parameterized templates","Exclude ParameterizedJob entries from eval automation","Operate on dispatched child job IDs for force-reschedule"],"tags":["nomad","parameterized-job","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}