hashicorp/nomad · error

HealthyDeadline is %s and must be >= 0

Error message

HealthyDeadline is %s and must be >= 0

What it means

MigrateStrategy.Validate rejects a negative HealthyDeadline. HealthyDeadline bounds how long the deployment waits for the minimum healthy allocations to appear; a negative deadline is invalid. Appended to the same multierror as the other strategy checks.

Source

Thrown at nomad/structs/structs.go:6859

	}

	switch m.HealthCheck {
	case MigrateStrategyHealthChecks, MigrateStrategyHealthStates:
		// ok
	case "":
		if m.MaxParallel > 0 {
			_ = multierror.Append(&mErr, fmt.Errorf("Missing HealthCheck"))
		}
	default:
		_ = multierror.Append(&mErr, fmt.Errorf("Invalid HealthCheck: %q", m.HealthCheck))
	}

	if m.MinHealthyTime < 0 {
		_ = multierror.Append(&mErr, fmt.Errorf("MinHealthyTime is %s and must be >= 0", m.MinHealthyTime))
	}

	if m.HealthyDeadline < 0 {
		_ = multierror.Append(&mErr, fmt.Errorf("HealthyDeadline is %s and must be >= 0", m.HealthyDeadline))
	}

	if m.MinHealthyTime > m.HealthyDeadline {
		_ = multierror.Append(&mErr, fmt.Errorf("MinHealthyTime must be less than HealthyDeadline"))
	}

	return mErr.ErrorOrNil()
}

// TaskGroup is an atomic unit of placement. Each task group belongs to
// a job and may contain any number of tasks. A task group support running
// in many replicas using the same configuration..
type TaskGroup struct {
	// Name of the task group
	Name string

	// Count is the number of replicas of this task group that should
	// be scheduled.

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set healthy_deadline to a positive duration (e.g. "5m", the common default).
  2. Fix the templating/computation that produced the negative value.
  3. Omit the field to use Nomad's default if supported by your tooling.
  4. Run `nomad job validate` before submit.

Example fix

// before
update {
  healthy_deadline = "-1m"
}
// after
update {
  healthy_deadline = "5m"
}
Defensive patterns

Strategy: validation

Validate before calling

func validHealthyDeadline(m *structs.MigrateStrategy) error {
	if m.HealthyDeadline < 0 {
		return fmt.Errorf("healthy_deadline must be >= 0, got %s", m.HealthyDeadline)
	}
	return nil
}

Type guard

func hasNonNegativeHealthyDeadline(m *structs.MigrateStrategy) bool {
	return m.HealthyDeadline >= 0
}

Try / catch

if err := strategy.Validate(); err != nil {
	if strings.Contains(err.Error(), "HealthyDeadline is") {
		// reset healthy_deadline to a positive default like 5m
	}
}

Prevention

When it happens

Trigger: Submitting a job with update block where healthy_deadline is negative (e.g. healthy_deadline = "-1m"), usually from templated or computed duration values gone wrong.

Common situations: Template math producing negative durations; sign typos in HCL; generated configs with bad defaults.

Related errors


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