hashicorp/nomad · error

error parsing Deadline: %w

Error message

error parsing Deadline: %w

What it means

DrainConfigFromAgent converts the agent's drain config; when a Deadline is set, time.ParseDuration fails on a malformed duration string, so node drain metadata cannot be translated into the client's DrainConfig.

Source

Thrown at client/config/drain.go:43

	Force bool
}

// DrainConfigFromAgent creates the internal read-only copy of the client
// agent's DrainConfig.
func DrainConfigFromAgent(c *config.DrainConfig) (*DrainConfig, error) {
	if c == nil {
		return nil, nil
	}

	deadline := time.Hour
	ignoreSystemJobs := false
	force := false

	if c.Deadline != nil {
		var err error
		deadline, err = time.ParseDuration(*c.Deadline)
		if err != nil {
			return nil, fmt.Errorf("error parsing Deadline: %w", err)
		}
	}
	if c.IgnoreSystemJobs != nil {
		ignoreSystemJobs = *c.IgnoreSystemJobs
	}
	if c.Force != nil {
		force = *c.Force
	}

	return &DrainConfig{
		Deadline:         deadline,
		IgnoreSystemJobs: ignoreSystemJobs,
		Force:            force,
	}, nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix the drain deadline in the agent config to a valid duration (e.g. "1h")
  2. Validate the deadline before sending the drain spec
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/config/drain.go:43 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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