{"record":{"id":"18a80aa54da6ab58","repo":"hashicorp/nomad","slug":"wait-config-min-d-is-greater-than-max-d","errorCode":null,"errorMessage":"wait config min %d is greater than max %d","messagePattern":"wait config min (.+?) is greater than max (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/config.go","lineNumber":711,"sourceCode":"}\n\n// Validate returns an error  if the receiver is nil or empty or if Min is greater\n// than Max the user specified Max.\nfunc (wc *WaitConfig) Validate() error {\n\t// If the config is nil or empty return false so that it is never assigned.\n\tif wc == nil || wc.IsEmpty() {\n\t\treturn errors.New(\"wait config is nil or empty\")\n\t}\n\n\t// If min is nil, return\n\tif wc.Min == nil {\n\t\treturn nil\n\t}\n\n\t// If min isn't nil, make sure Max is less than Min.\n\tif wc.Max != nil {\n\t\tif *wc.Min > *wc.Max {\n\t\t\treturn fmt.Errorf(\"wait config min %d is greater than max %d\", *wc.Min, *wc.Max)\n\t\t}\n\t}\n\n\t// Otherwise, return nil. Consul Template will set a Max based off of Min.\n\treturn nil\n}\n\n// Merge merges two WaitConfigs. The passed instance always takes precedence.\nfunc (wc *WaitConfig) Merge(b *WaitConfig) *WaitConfig {\n\tif wc == nil {\n\t\treturn b\n\t}\n\n\tresult := *wc\n\tif b == nil {\n\t\treturn &result\n\t}\n","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/config.go#L693-L729","documentation":"WaitConfig.Validate checks the client's wait configuration (used by template/consul-style waiting semantics): if Min is set and Max is also set, Max must be greater than or equal to Min. Otherwise Consul Template cannot form a sane wait interval, so validation fails with this message embedding both values.","triggerScenarios":"Calling WaitConfig.Validate (directly or via config validation during agent startup) on a WaitConfig where *Min > *Max, e.g. min=10s max=5s; or after a Merge that combined two configs producing inverted bounds.","commonSituations":"wait { min = ... max = ... } block in agent config with min larger than max; merging layered config files (base + override) where an override sets a smaller max; refactored code setting fields independently without re-checking ordering.","solutions":["Swap or adjust the values so min <= max in the wait config block, e.g. min=\"5s\" max=\"10s\"","If only a min is desired, remove max and let Consul Template derive a default max from min","Check merged config layers for a stray max value and remove the conflicting one","Run validation on the merged config before startup to catch inversions early"],"exampleFix":"// before\nwait {\n  min = \"30s\"\n  max = \"10s\"\n}\n// after\nwait {\n  min = \"10s\"\n  max = \"30s\"\n}","handlingStrategy":"validation","validationCode":"func validateWait(min, max *time.Duration) error {\n    if min != nil && max != nil && *min > *max {\n        return fmt.Errorf(\"wait min %s > max %s\", *min, *max)\n    }\n    return nil\n}","typeGuard":"func waitBoundsOK(wc *config.WaitConfig) bool {\n    return wc == nil || wc.Min == nil || wc.Max == nil || *wc.Min <= *wc.Max\n}","tryCatchPattern":"if err := wc.Validate(); err != nil {\n    if strings.Contains(err.Error(), \"min\") && strings.Contains(err.Error(), \"greater than max\") {\n        wc.Max = nil // let Consul Template derive max from min\n    } else {\n        return err\n    }\n}","preventionTips":["Keep max >= min in every wait block; a quick eye check on config review suffices","Re-validate after merging config layers or overrides","Prefer setting only min and letting the library derive max"],"tags":["config","validation","wait","go"],"backgroundTag":"invalid-config-value","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}