{"record":{"id":"e4160dbf6f171298","repo":"hashicorp/nomad","slug":"service-on-update-must-be-q-q-or-q-not-q","errorCode":null,"errorMessage":"Service on_update must be %q, %q, or %q; not %q","messagePattern":"Service on_update must be %q, %q, or %q; not %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/services.go","lineNumber":788,"sourceCode":"\t\t// Log actual service name, not the stripped version.\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"%v: %q\", err, s.Name))\n\t}\n\n\tswitch s.AddressMode {\n\tcase \"\", AddressModeAuto:\n\tcase AddressModeHost, AddressModeDriver, AddressModeAlloc, AddressModeAllocIPv6:\n\t\tif s.Address != \"\" {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Service address_mode must be %q if address is set\", AddressModeAuto))\n\t\t}\n\tdefault:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Service address_mode must be %q, %q, or %q; not %q\", AddressModeAuto, AddressModeHost, AddressModeDriver, s.AddressMode))\n\t}\n\n\tswitch s.OnUpdate {\n\tcase \"\", OnUpdateIgnore, OnUpdateRequireHealthy, OnUpdateIgnoreWarn:\n\t\t// OK\n\tdefault:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Service on_update must be %q, %q, or %q; not %q\", OnUpdateRequireHealthy, OnUpdateIgnoreWarn, OnUpdateIgnore, s.OnUpdate))\n\t}\n\n\t// Up until this point, all service validation has been independent of the\n\t// provider. From this point on, we have different validation paths. We can\n\t// also catch an incorrect provider parameter.\n\tswitch s.Provider {\n\tcase ServiceProviderConsul:\n\t\ts.validateConsulService(&mErr)\n\tcase ServiceProviderNomad:\n\t\ts.validateNomadService(&mErr)\n\tdefault:\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"Service provider must be %q, or %q; not %q\",\n\t\t\tServiceProviderConsul, ServiceProviderNomad, s.Provider))\n\t}\n\n\tif err := s.validateIdentity(); err != nil {\n\t\tmErr.Errors = append(mErr.Errors, err)\n\t}","sourceCodeStart":770,"sourceCodeEnd":806,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/services.go#L770-L806","documentation":"In Service.Validate, the on_update field did not match any allowed value (require_healthy, ignore_warnings). It fires from the switch validating update behavior for service registrations during deployments.","triggerScenarios":"Setting on_update to an unrecognized string (e.g. \"healthy\", \"required\") on a service and validating the job.","commonSituations":"Typos; copying Consul's similar-but-different keywords; pre-1.x configs written before on_update existed.","solutions":["Use one of: ignore, require_healthy, ignore_warn","Omit on_update to accept the default require_healthy","Fix the typo in the on_update value"],"exampleFix":"// before\non_update = \"require_healthy\"\n// after\non_update = \"require_healthy\" # valid; invalid example was on_update = \"healthy\"","handlingStrategy":"validation","validationCode":"var onUpdate = []string{\"\",\"ignore\",\"require_healthy\",\"ignore_warn\"}\nif !slices.Contains(onUpdate, s.OnUpdate) {\n    return fmt.Errorf(\"invalid on_update %q\", s.OnUpdate)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only documented on_update values","Validate jobs with nomad job validate before deploying"],"tags":["nomad","on-update","validation"],"backgroundTag":"invalid-check-configuration","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"}