{"record":{"id":"438045ef97683fdb","repo":"hashicorp/nomad","slug":"field-dispatched-is-read-only","errorCode":null,"errorMessage":"field 'Dispatched' is read-only","messagePattern":"field 'Dispatched' is read-only","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":1977,"sourceCode":"\n\t// Transitioning to/from periodic is disallowed\n\tif old.IsPeriodic() && !new.IsPeriodic() {\n\t\treturn fmt.Errorf(\"cannot update periodic job to being non-periodic\")\n\t}\n\tif new.IsPeriodic() && !old.IsPeriodic() {\n\t\treturn fmt.Errorf(\"cannot update non-periodic job to being periodic\")\n\t}\n\n\t// Transitioning to/from parameterized is disallowed\n\tif old.IsParameterized() && !new.IsParameterized() {\n\t\treturn fmt.Errorf(\"cannot update parameterized job to being non-parameterized\")\n\t}\n\tif new.IsParameterized() && !old.IsParameterized() {\n\t\treturn fmt.Errorf(\"cannot update non-parameterized job to being parameterized\")\n\t}\n\n\tif old.Dispatched != new.Dispatched {\n\t\treturn fmt.Errorf(\"field 'Dispatched' is read-only\")\n\t}\n\n\treturn nil\n}\n\n// Dispatch a parameterized job.\nfunc (j *Job) Dispatch(args *structs.JobDispatchRequest, reply *structs.JobDispatchResponse) error {\n\tauthErr := j.srv.Authenticate(j.ctx, args)\n\tif done, err := j.srv.forward(\"Job.Dispatch\", args, args, reply); done {\n\t\treturn err\n\t}\n\tj.srv.MeasureRPCRate(\"job\", structs.RateMetricWrite, args)\n\tif authErr != nil {\n\t\treturn structs.ErrPermissionDenied\n\t}\n\tdefer metrics.MeasureSince([]string{\"nomad\", \"job\", \"dispatch\"}, time.Now())\n\n\t// Check for submit-job permissions","sourceCodeStart":1959,"sourceCodeEnd":1995,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L1959-L1995","documentation":"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.","triggerScenarios":"Thrown at nomad/job_endpoint.go:1977 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send the job spec with the original Dispatched value (normally absent/false)","Regenerate the job file from nomad job inspect without hand-editing Dispatched"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}