{"record":{"id":"97906f3f40b0acd9","repo":"hashicorp/nomad","slug":"cannot-update-non-periodic-job-to-being-periodic","errorCode":null,"errorMessage":"cannot update non-periodic job to being periodic","messagePattern":"cannot update non-periodic job to being periodic","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/job_endpoint.go","lineNumber":1965,"sourceCode":"\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\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.","sourceCodeStart":1947,"sourceCodeEnd":1983,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/job_endpoint.go#L1947-L1983","documentation":"Fires in validateJobUpdate when a non-periodic job is updated to include an enabled periodic block; a job cannot gain periodic scheduling semantics after registration.","triggerScenarios":"Thrown at nomad/job_endpoint.go:1965 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Register a new job with the periodic block instead of updating","Use nomad job dispatch / cron externally if you need delayed or scheduled runs of an existing job"],"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"}