{"record":{"id":"e02faab598e84c6a","repo":"hashicorp/nomad","slug":"max-delay-cannot-be-less-than-v-got-v","errorCode":null,"errorMessage":"Max Delay cannot be less than %v (got %v)","messagePattern":"Max Delay cannot be less than (.+?) \\(got (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":6680,"sourceCode":"\t}\n\n\tdelayPreCheck := true\n\t// Delay should be bigger than the default\n\tif r.Delay.Nanoseconds() < ReschedulePolicyMinDelay.Nanoseconds() {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Delay cannot be less than %v (got %v)\", ReschedulePolicyMinDelay, r.Delay))\n\t\tdelayPreCheck = false\n\t}\n\n\t// Must use a valid delay function\n\tif !isValidDelayFunction(r.DelayFunction) {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Invalid delay function %q, must be one of %q\", r.DelayFunction, RescheduleDelayFunctions))\n\t\tdelayPreCheck = false\n\t}\n\n\t// Validate MaxDelay if not using linear delay progression\n\tif r.DelayFunction != \"constant\" {\n\t\tif r.MaxDelay.Nanoseconds() < ReschedulePolicyMinDelay.Nanoseconds() {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Max Delay cannot be less than %v (got %v)\", ReschedulePolicyMinDelay, r.Delay))\n\t\t\tdelayPreCheck = false\n\t\t}\n\t\tif r.MaxDelay < r.Delay {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Max Delay cannot be less than Delay %v (got %v)\", r.Delay, r.MaxDelay))\n\t\t\tdelayPreCheck = false\n\t\t}\n\n\t}\n\n\t// Validate Interval and other delay parameters if attempts are limited\n\tif !r.Unlimited {\n\t\tif r.Interval.Nanoseconds() < ReschedulePolicyMinInterval.Nanoseconds() {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Interval cannot be less than %v (got %v)\", ReschedulePolicyMinInterval, r.Interval))\n\t\t}\n\t\tif !delayPreCheck {\n\t\t\t// We can't cross validate the rest of the delay params if delayPreCheck fails, so return early\n\t\t\treturn mErr.ErrorOrNil()\n\t\t}","sourceCodeStart":6662,"sourceCodeEnd":6698,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L6662-L6698","documentation":"ReschedulePolicy.Validate() requires MaxDelay to be at least ReschedulePolicyMinDelay for any delay_function other than \"constant\" (progressive functions grow the delay up to MaxDelay, so a valid ceiling is mandatory). Note the message prints r.Delay in the 'got' slot even though it checks r.MaxDelay — a known quirk of this error string.","triggerScenarios":"A reschedule block with delay_function = \"linear\"/\"exponential\"/\"fibonacci\" and max_delay below the minimum (e.g. 0 or < 30s), typically when max_delay was omitted or zero-valued in code-built policies.","commonSituations":"Omitting max_delay while setting a non-constant delay function, passing max_delay as an untyped zero, or unit mistakes making the duration tiny.","solutions":["Set max_delay to a duration >= 30s (e.g. max_delay = \"1h\").","If a fixed delay is wanted, use delay_function = \"constant\" so max_delay is not required.","Ignore the misleading '(got ...)' value — fix max_delay itself."],"exampleFix":"// before\nreschedule {\n  delay_function = \"exponential\"\n  delay          = \"30s\"\n}\n// after\nreschedule {\n  delay_function = \"exponential\"\n  delay          = \"30s\"\n  max_delay      = \"1h\"\n}","handlingStrategy":"validation","validationCode":"if rsl != nil && rsl.DelayFunction != \"constant\" && rsl.MaxDelay.Nanoseconds() < structs.ReschedulePolicyMinDelay.Nanoseconds() {\n    return fmt.Errorf(\"non-constant delay_function requires max_delay >= %v\", structs.ReschedulePolicyMinDelay)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set max_delay when using linear/exponential/fibonacci.","Default max_delay to >= 1h for progressive functions.","Remember the error's '(got ...)' prints delay, not max_delay — check max_delay itself."],"tags":["nomad","validation","duration","reschedule-policy"],"backgroundTag":"missing-required-argument","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"}