hashicorp/nomad · error

server_join and retry_interval cannot both be defined; prefe

Error message

server_join and retry_interval cannot both be defined; prefer setting the server_join block

What it means

retryJoiner.Validate rejects configurations where the server_join block's retry_join and the top-level retry_interval are both set. retry_interval (delay between join retries) belongs inside the server_join block now.

Source

Thrown at command/agent/retry_join.go:139

// Validate ensures that the configuration passes validity checks for the
// retry_join block. If the configuration is not valid, returns an error that
// will be displayed to the operator, otherwise nil.
func (r *retryJoiner) Validate(config *Config) error {
	// If retry_join is defined for the server, ensure that deprecated
	// fields and the server_join block are not both set
	if config.Server != nil && config.Server.ServerJoin != nil && len(config.Server.ServerJoin.RetryJoin) != 0 {
		if len(config.Server.RetryJoin) != 0 {
			return fmt.Errorf("server_join and retry_join cannot both be defined; prefer setting the server_join block")
		}
		if len(config.Server.StartJoin) != 0 {
			return fmt.Errorf("server_join and start_join cannot both be defined; prefer setting the server_join block")
		}
		if config.Server.RetryMaxAttempts != 0 {
			return fmt.Errorf("server_join and retry_max cannot both be defined; prefer setting the server_join block")
		}

		if config.Server.RetryInterval != 0 {
			return fmt.Errorf("server_join and retry_interval cannot both be defined; prefer setting the server_join block")
		}

		if len(config.Server.ServerJoin.StartJoin) != 0 {
			return fmt.Errorf("retry_join and start_join cannot both be defined")
		}
	}

	// if retry_join is defined for the client, ensure that start_join is not
	// set as this configuration is only defined for servers.
	if config.Client != nil && config.Client.ServerJoin != nil {
		if config.Client.ServerJoin.StartJoin != nil {
			return fmt.Errorf("start_join is not supported for Nomad clients")
		}
	}

	return nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Move retry_interval into the server_join block (server_join { retry_interval }) and remove the top-level key
  2. Check for and remove any other deprecated server keys flagged by the same Validate path
  3. Run nomad config validate after edits

Example fix

// before
server {
  retry_interval = "15s"
  server_join {
    retry_join = ["1.2.3.4"]
  }
}
// after
server {
  server_join {
    retry_join = ["1.2.3.4"]
    retry_interval = "15s"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if s := cfg.Server; s != nil && s.ServerJoin != nil && len(s.ServerJoin.RetryJoin) > 0 && s.RetryInterval != 0 {
    return errors.New("move retry_interval into server_join")
}

Prevention

When it happens

Trigger: Config where server.server_join.retry_join is set AND server.retry_interval != 0; Validate fails at agent startup.

Common situations: Legacy configs with retry_interval plus newly added server_join block; infrastructure-as-code templates not updated after a Nomad upgrade.

Related errors


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