hashicorp/nomad · error

can't evaluate parameterized job

Error message

can't evaluate parameterized job

What it means

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().

Source

Thrown at nomad/job_endpoint.go:720

	// Lookup the job
	snap, err := j.srv.fsm.State().Snapshot()
	if err != nil {
		return err
	}
	ws := memdb.NewWatchSet()
	job, err := snap.JobByID(ws, args.RequestNamespace(), args.JobID)
	if err != nil {
		return err
	}
	if job == nil {
		return fmt.Errorf("job not found")
	}

	if job.IsPeriodic() {
		return fmt.Errorf("can't evaluate periodic job")
	} else if job.IsParameterized() {
		return fmt.Errorf("can't evaluate parameterized job")
	}

	forceRescheduleAllocs := make(map[string]*structs.DesiredTransition)

	if args.EvalOptions.ForceReschedule {
		// Find any failed allocs that could be force rescheduled
		allocs, err := snap.AllocsByJob(ws, args.RequestNamespace(), args.JobID, false)
		if err != nil {
			return err
		}

		for _, alloc := range allocs {
			taskGroup := job.LookupTaskGroup(alloc.TaskGroup)
			// Forcing rescheduling is only allowed if task group has rescheduling enabled
			if taskGroup == nil || !taskGroup.ReschedulePolicy.Enabled() {
				continue
			}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Dispatch a child instead: POST /v1/job/<id>/dispatch (nomad job dispatch <id>)
  2. Evaluate the dispatched child job ID (e.g. <template>/dispatch-<timestamp>)
  3. Exclude parameterized jobs in bulk automation (check job.ParameterizedJob client-side)
  4. Force-reschedule the child job's allocations with EvalOptions.ForceReschedule on the child

Example fix

// before
client.Jobs().Evaluate("batch-template", nil)
// after
client.Jobs().Dispatch("batch-template", nil, nil, false, nil)
Defensive patterns

Strategy: validation

Validate before calling

job, _, err := client.Jobs().Info(jobID, nil)
if err != nil { return err }
if job.ParameterizedJob != nil {
	return fmt.Errorf("%s is parameterized; dispatch instead", jobID)
}

Type guard

func isParameterizedTemplate(j *api.Job) bool { return j != nil && j.ParameterizedJob != nil }

Try / catch

if _, _, err := client.Jobs().Evaluate(jobID, nil); err != nil && strings.Contains(err.Error(), "parameterized") {
	_, _, err = client.Jobs().Dispatch(jobID, nil, nil, false, nil)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/518ae34b47ef3993. Report an issue: GitHub.