{"record":{"id":"a161c3e00828bb03","repo":"hashicorp/nomad","slug":"on-update-must-be-q-q-or-q-got-q","errorCode":null,"errorMessage":"on_update must be %q, %q, or %q; got %q","messagePattern":"on_update must be %q, %q, or %q; got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":323,"sourceCode":"\t\treturn fmt.Errorf(`invalid initial check state (%s), must be one of %q, %q, %q or empty`, sc.InitialStatus, api.HealthPassing, api.HealthWarning, api.HealthCritical)\n\t}\n\n\t// validate address_mode\n\tswitch sc.AddressMode {\n\tcase \"\", AddressModeHost, AddressModeDriver, AddressModeAlloc, AddressModeAllocIPv6:\n\t\t// Ok\n\tcase AddressModeAuto:\n\t\treturn fmt.Errorf(\"invalid address_mode %q - %s only valid for services\", sc.AddressMode, AddressModeAuto)\n\tdefault:\n\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","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L305-L341","documentation":"Raised by ServiceCheck.validateCommon when a check's on_update field is not one of the allowed values: require_healthy, ignore_warning, ignore, or empty (which defaults to require_healthy). on_update controls how the updater treats check results during deployments, so Nomad validates it strictly at registration time.","triggerScenarios":"Submitting a job with check { on_update = \"ignore_warnings\" } or any string other than require_healthy/ignore_warning/ignore, via nomad job run or the jobs API.","commonSituations":"Singular/plural confusion (ignore_warning vs ignore_warnings); guessing value names instead of checking docs; copying on_update conventions from health-check tooling with different vocabularies.","solutions":["Set on_update to exactly \"require_healthy\", \"ignore_warning\", or \"ignore\" (lowercase, underscore)","Omit on_update to accept the require_healthy default","Check for pluralization/spacing typos (ignore_warnings, ignore-warning are invalid)","Run nomad job validate before submission"],"exampleFix":"// before\ncheck {\n  type      = \"http\"\n  path      = \"/health\"\n  on_update = \"ignore_warnings\"\n}\n// after\ncheck {\n  type      = \"http\"\n  path      = \"/health\"\n  on_update = \"ignore_warning\"\n}","handlingStrategy":"validation","validationCode":"// Go: whitelist on_update before submission\nvar validOnUpdate = map[string]bool{\n\t\"\": true,\n\t\"require_healthy\": true, \"ignore_warning\": true, \"ignore\": true,\n}\nif !validOnUpdate[check.OnUpdate] {\n\treturn fmt.Errorf(\"on_update %q invalid; use require_healthy|ignore_warning|ignore\", check.OnUpdate)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the exact three values: require_healthy, ignore_warning, ignore","Omit on_update when require_healthy default is acceptable","Lint job specs against Nomad's schema in CI","Run `nomad job validate` before every submit"],"tags":["nomad","service-check","config-validation","deployment"],"backgroundTag":"invalid-enum-value","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"}