{"record":{"id":"df8dd327aae3c7b3","repo":"hashicorp/nomad","slug":"cannot-update-job-from-type-q-to-q","errorCode":null,"errorMessage":"cannot update job from type %q to %q","messagePattern":"cannot update job from type %q to %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":1957,"sourceCode":"\treply.Annotations = annotations\n\treply.CreatedEvals = planner.CreateEvals\n\treply.Index = index\n\treturn nil\n}\n\n// validateJobUpdate ensures updates to a job are valid.\nfunc validateJobUpdate(old, new *structs.Job) error {\n\t// Validate Dispatch not set on new Jobs\n\tif old == nil {\n\t\tif new.Dispatched {\n\t\t\treturn fmt.Errorf(\"job can't be submitted with 'Dispatched' set\")\n\t\t}\n\t\treturn nil\n\t}\n\n\t// Type transitions are disallowed\n\tif old.Type != new.Type {\n\t\treturn fmt.Errorf(\"cannot update job from type %q to %q\", old.Type, new.Type)\n\t}\n\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","sourceCodeStart":1939,"sourceCodeEnd":1975,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L1939-L1975","documentation":"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.","triggerScenarios":"Thrown at nomad/job_endpoint.go:1957 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep the job type unchanged when updating","Deregister the job and register a new one with the new type (losing history/versions)"],"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"}