hashicorp/nomad · error

Invalid delay function %q, must be one of %q

Error message

Invalid delay function %q, must be one of %q

What it means

ReschedulePolicy.Validate() checks delay_function against the allowed set (RescheduleDelayFunctions: "constant", "exponential", "fibonacci", "linear"). An unknown function name cannot be evaluated, so the policy is rejected.

Source

Thrown at nomad/structs/structs.go:6673

			_ = multierror.Append(&mErr, fmt.Errorf("Interval must be a non zero value if Attempts > 0"))
		}
		if r.Unlimited {
			_ = multierror.Append(&mErr, fmt.Errorf("Reschedule Policy with Attempts = %v, Interval = %v, "+
				"and Unlimited = %v is ambiguous", r.Attempts, r.Interval, r.Unlimited))
			_ = multierror.Append(&mErr, errors.New("If Attempts >0, Unlimited cannot also be set to true"))
		}
	}

	delayPreCheck := true
	// Delay should be bigger than the default
	if r.Delay.Nanoseconds() < ReschedulePolicyMinDelay.Nanoseconds() {
		_ = multierror.Append(&mErr, fmt.Errorf("Delay cannot be less than %v (got %v)", ReschedulePolicyMinDelay, r.Delay))
		delayPreCheck = false
	}

	// Must use a valid delay function
	if !isValidDelayFunction(r.DelayFunction) {
		_ = multierror.Append(&mErr, fmt.Errorf("Invalid delay function %q, must be one of %q", r.DelayFunction, RescheduleDelayFunctions))
		delayPreCheck = false
	}

	// Validate MaxDelay if not using linear delay progression
	if r.DelayFunction != "constant" {
		if r.MaxDelay.Nanoseconds() < ReschedulePolicyMinDelay.Nanoseconds() {
			_ = multierror.Append(&mErr, fmt.Errorf("Max Delay cannot be less than %v (got %v)", ReschedulePolicyMinDelay, r.Delay))
			delayPreCheck = false
		}
		if r.MaxDelay < r.Delay {
			_ = multierror.Append(&mErr, fmt.Errorf("Max Delay cannot be less than Delay %v (got %v)", r.Delay, r.MaxDelay))
			delayPreCheck = false
		}

	}

	// Validate Interval and other delay parameters if attempts are limited
	if !r.Unlimited {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set delay_function to one of: "constant", "linear", "exponential", "fibonacci".
  2. Check spelling and lowercase form.
  3. Consult `nomad job validate` output, which lists the accepted values.

Example fix

// before
reschedule {
  delay_function = "backoff"
}
// after
reschedule {
  delay_function = "exponential"
}
Defensive patterns

Strategy: validation

Validate before calling

valid := map[string]bool{"constant": true, "linear": true, "exponential": true, "fibonacci": true}
if rsl != nil && !valid[rsl.DelayFunction] {
    return fmt.Errorf("delay_function %q invalid; use constant|linear|exponential|fibonacci", rsl.DelayFunction)
}

Type guard

func isValidDelayFunctionName(f string) bool {
    switch f {
    case "constant", "linear", "exponential", "fibonacci":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: A reschedule block with delay_function set to any string outside {constant, linear, exponential, fibonacci}, e.g. "fixed", "backoff", or a capitalized/mistyped value.

Common situations: Guessing the function name from other tools' backoff vocabularies, typos like "exponetial", or older Nomad versions where some functions did not yet exist being upgraded.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/f8fdac4dadb4b5bf. Report an issue: GitHub.