hashicorp/nomad · error
Parameterized job can only be used with
Error message
Parameterized job can only be used with %q or %q scheduler
What it means
Job.Validate enforces that parameterized jobs (IsParameterized, i.e. a parameterized_job block is present) may only run under the batch or sysbatch scheduler. Otherwise the error 'Parameterized job can only be used with "batch" or "sysbatch" scheduler' is appended.
Solutions
- Set `type = "batch"` (or "sysbatch") on the parameterized job.
- Or remove the `parameterized_job` block if dispatch semantics are not needed.
- Validate with `nomad job validate` before submission.
Example fix
// before
job "dispatch-me" {
type = "service"
parameterized_job { payload = "required" }
}
// after
job "dispatch-me" {
type = "batch"
parameterized_job { payload = "required" }
} Defensive patterns
Strategy: validation
Validate before calling
if job.IsParameterized() &&
job.Type != "batch" && job.Type != "sysbatch" {
return fmt.Errorf("parameterized job must be type batch or sysbatch, got %q", job.Type)
} Prevention
- Pair every `parameterized_job` block with `type = "batch"`.
- Use dispatch job templates that include the correct type.
- Validate dispatch job specs as part of CI.
When it happens
Trigger: Submitting a job containing a `parameterized_job` stanza while job type is "service", "system", or unset/derived to a non-batch type.
Common situations: Adding dispatch capability to an existing service job; scaffolding a dispatch job from a template that omitted type = "batch"; API clients setting ParameterizedJob on a structs.Job without adjusting Type.
Related errors
- Action defined multiple times
- Action validation failed
- can't evaluate parameterized job
- Consul Connect group
- Consul Connect service name
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/882b704ae13689fd.
Report an issue: GitHub.
Appendix: source
Thrown at nomad/structs/structs.go:4869
}
}
// Validate periodic is only used with batch or sysbatch jobs.
if j.IsPeriodic() && j.Periodic.Enabled {
if j.Type != JobTypeBatch && j.Type != JobTypeSysBatch {
mErr.Errors = append(mErr.Errors, fmt.Errorf(
"Periodic can only be used with %q or %q scheduler", JobTypeBatch, JobTypeSysBatch,
))
}
if err := j.Periodic.Validate(); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
}
if j.IsParameterized() {
if j.Type != JobTypeBatch && j.Type != JobTypeSysBatch {
mErr.Errors = append(mErr.Errors, fmt.Errorf(
"Parameterized job can only be used with %q or %q scheduler", JobTypeBatch, JobTypeSysBatch,
))
}
if err := j.ParameterizedJob.Validate(); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
}
if j.IsMultiregion() {
if err := j.Multiregion.Validate(j.Type, j.Datacenters); err != nil {
mErr.Errors = append(mErr.Errors, err)
}
}
return mErr.ErrorOrNil()
}
View on GitHub (pinned to 482b49bf1a)