{"record":{"id":"46dca8247fc96ca7","repo":"hashicorp/nomad","slug":"on-update-value-q-is-not-compatible-with-check-re","errorCode":null,"errorMessage":"on_update value %q is not compatible with check_restart","messagePattern":"on_update value %q is not compatible with check_restart","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":333,"sourceCode":"\t\treturn fmt.Errorf(\"invalid address_mode %q\", sc.AddressMode)\n\t}\n\n\t// validate on_update\n\tswitch sc.OnUpdate {\n\tcase \"\", OnUpdateIgnore, OnUpdateRequireHealthy, OnUpdateIgnoreWarn:\n\t\t// OK\n\tdefault:\n\t\treturn fmt.Errorf(\"on_update must be %q, %q, or %q; got %q\", OnUpdateRequireHealthy, OnUpdateIgnoreWarn, OnUpdateIgnore, sc.OnUpdate)\n\t}\n\n\t// validate check_restart and on_update do not conflict\n\tif sc.CheckRestart != nil {\n\t\t// CheckRestart and OnUpdate Ignore are incompatible If OnUpdate treats\n\t\t// an error has healthy, and the deployment succeeds followed by check\n\t\t// restart restarting failing checks, the deployment is left in an odd\n\t\t// state\n\t\tif sc.OnUpdate == OnUpdateIgnore {\n\t\t\treturn fmt.Errorf(\"on_update value %q is not compatible with check_restart\", sc.OnUpdate)\n\t\t}\n\t\t// CheckRestart IgnoreWarnings must be true if a check has defined OnUpdate\n\t\t// ignore_warnings\n\t\tif !sc.CheckRestart.IgnoreWarnings && sc.OnUpdate == OnUpdateIgnoreWarn {\n\t\t\treturn fmt.Errorf(\"on_update value %q not supported with check_restart ignore_warnings value %q\", sc.OnUpdate, strconv.FormatBool(sc.CheckRestart.IgnoreWarnings))\n\t\t}\n\t}\n\n\t// validate check_restart\n\tif err := sc.CheckRestart.Validate(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}\n\n// validate a Service's ServiceCheck in the context of the Nomad provider.\nfunc (sc *ServiceCheck) validateNomad() error {","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L315-L351","documentation":"The check sets on_update=\"ignore\" together with a check_restart block; validateCommon rejects this combination because treating check errors as healthy during updates conflicts with check-based restarts, leaving deployments in an inconsistent state.","triggerScenarios":"Thrown at nomad/structs/services.go:333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change on_update to \"require_healthy\" or \"ignore_warnings\"","Remove the check_restart block if on_update must stay \"ignore\""],"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"}