hashicorp/nomad · error

cannot update job from type %q to %q

Error message

cannot update job from type %q to %q

What it means

Fires in validateJobUpdate when an existing job is resubmitted with a different Type (e.g. service to batch); Nomad requires job type to stay fixed across updates because scheduling semantics differ.

Source

Thrown at nomad/job_endpoint.go:1957

	reply.Annotations = annotations
	reply.CreatedEvals = planner.CreateEvals
	reply.Index = index
	return nil
}

// validateJobUpdate ensures updates to a job are valid.
func validateJobUpdate(old, new *structs.Job) error {
	// Validate Dispatch not set on new Jobs
	if old == nil {
		if new.Dispatched {
			return fmt.Errorf("job can't be submitted with 'Dispatched' set")
		}
		return nil
	}

	// Type transitions are disallowed
	if old.Type != new.Type {
		return fmt.Errorf("cannot update job from type %q to %q", old.Type, new.Type)
	}

	// Transitioning to/from periodic is disallowed
	if old.IsPeriodic() && !new.IsPeriodic() {
		return fmt.Errorf("cannot update periodic job to being non-periodic")
	}
	if new.IsPeriodic() && !old.IsPeriodic() {
		return fmt.Errorf("cannot update non-periodic job to being periodic")
	}

	// Transitioning to/from parameterized is disallowed
	if old.IsParameterized() && !new.IsParameterized() {
		return fmt.Errorf("cannot update parameterized job to being non-parameterized")
	}
	if new.IsParameterized() && !old.IsParameterized() {
		return fmt.Errorf("cannot update non-parameterized job to being parameterized")
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Keep the job type unchanged when updating
  2. Deregister the job and register a new one with the new type (losing history/versions)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/job_endpoint.go:1957 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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