hashicorp/nomad · error

field 'Dispatched' is read-only

Error message

field 'Dispatched' is read-only

What it means

Fires in validateJobUpdate when an existing job is resubmitted with a changed Dispatched value; the flag records whether the job came from dispatch and is immutable/read-only from the client.

Source

Thrown at nomad/job_endpoint.go:1977

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

// Dispatch a parameterized job.
func (j *Job) Dispatch(args *structs.JobDispatchRequest, reply *structs.JobDispatchResponse) error {
	authErr := j.srv.Authenticate(j.ctx, args)
	if done, err := j.srv.forward("Job.Dispatch", args, args, reply); done {
		return err
	}
	j.srv.MeasureRPCRate("job", structs.RateMetricWrite, args)
	if authErr != nil {
		return structs.ErrPermissionDenied
	}
	defer metrics.MeasureSince([]string{"nomad", "job", "dispatch"}, time.Now())

	// Check for submit-job permissions

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Send the job spec with the original Dispatched value (normally absent/false)
  2. Regenerate the job file from nomad job inspect without hand-editing Dispatched
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nomad/job_endpoint.go:1977 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/438045ef97683fdb. Report an issue: GitHub.