hashicorp/nomad · error

cannot update periodic job to being non-periodic

Error message

cannot update periodic job to being non-periodic

What it means

Fires in validateJobUpdate when updating a job that was periodic into one whose spec no longer enables periodic scheduling; the periodic/non-periodic divide cannot be crossed on update.

Source

Thrown at nomad/job_endpoint.go:1962

// 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")
	}

	if old.Dispatched != new.Dispatched {
		return fmt.Errorf("field 'Dispatched' is read-only")
	}

	return nil

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Keep the periodic block enabled in the updated job
  2. Create a new job if periodic behavior is no longer wanted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/job_endpoint.go:1962 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/444bf9f582f7d94e. Report an issue: GitHub.