{"record":{"id":"94cbe1ea1bed7230","repo":"hashicorp/nomad","slug":"server-join-and-retry-max-cannot-both-be-defined","errorCode":null,"errorMessage":"server_join and retry_max cannot both be defined; prefer setting the server_join block","messagePattern":"server_join and retry_max cannot both be defined; prefer setting the server_join block","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/retry_join.go","lineNumber":135,"sourceCode":"\t// logger is the retry joiners logger\n\tlogger log.Logger\n}\n\n// Validate ensures that the configuration passes validity checks for the\n// retry_join block. If the configuration is not valid, returns an error that\n// will be displayed to the operator, otherwise nil.\nfunc (r *retryJoiner) Validate(config *Config) error {\n\t// If retry_join is defined for the server, ensure that deprecated\n\t// fields and the server_join block are not both set\n\tif config.Server != nil && config.Server.ServerJoin != nil && len(config.Server.ServerJoin.RetryJoin) != 0 {\n\t\tif len(config.Server.RetryJoin) != 0 {\n\t\t\treturn fmt.Errorf(\"server_join and retry_join cannot both be defined; prefer setting the server_join block\")\n\t\t}\n\t\tif len(config.Server.StartJoin) != 0 {\n\t\t\treturn fmt.Errorf(\"server_join and start_join cannot both be defined; prefer setting the server_join block\")\n\t\t}\n\t\tif config.Server.RetryMaxAttempts != 0 {\n\t\t\treturn fmt.Errorf(\"server_join and retry_max cannot both be defined; prefer setting the server_join block\")\n\t\t}\n\n\t\tif config.Server.RetryInterval != 0 {\n\t\t\treturn fmt.Errorf(\"server_join and retry_interval cannot both be defined; prefer setting the server_join block\")\n\t\t}\n\n\t\tif len(config.Server.ServerJoin.StartJoin) != 0 {\n\t\t\treturn fmt.Errorf(\"retry_join and start_join cannot both be defined\")\n\t\t}\n\t}\n\n\t// if retry_join is defined for the client, ensure that start_join is not\n\t// set as this configuration is only defined for servers.\n\tif config.Client != nil && config.Client.ServerJoin != nil {\n\t\tif config.Client.ServerJoin.StartJoin != nil {\n\t\t\treturn fmt.Errorf(\"start_join is not supported for Nomad clients\")\n\t\t}\n\t}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/retry_join.go#L117-L153","documentation":"retryJoiner.Validate rejects configurations where the server_join block and the deprecated top-level retry_max field are both set. retry_max (max join attempts) now lives inside server_join as retry_max_attempts.","triggerScenarios":"Config where server.server_join.retry_join is set AND server.retry_max != 0; Validate fails during agent startup config parsing.","commonSituations":"Old configs carrying retry_max from pre-server_join versions, then adding server_join; copy-paste between old and new config examples.","solutions":["Remove top-level server.retry_max and set server_join { retry_max_attempts } instead","Audit the server stanza for other deprecated keys (retry_join, start_join, retry_interval) and migrate them together","Validate the config with nomad config validate before restart"],"exampleFix":"// before\nserver {\n  retry_max = 5\n  server_join {\n    retry_join = [\"1.2.3.4\"]\n  }\n}\n// after\nserver {\n  server_join {\n    retry_join = [\"1.2.3.4\"]\n    retry_max_attempts = 5\n  }\n}","handlingStrategy":"validation","validationCode":"if s := cfg.Server; s != nil && s.ServerJoin != nil && len(s.ServerJoin.RetryJoin) > 0 && s.RetryMaxAttempts != 0 {\n    return errors.New(\"move retry_max into server_join.retry_max_attempts\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set retry_max_attempts inside server_join, not top-level retry_max","Run nomad config validate in CI","Audit pre-upgrade configs for deprecated server keys","Keep a single canonical server_join config template"],"tags":["nomad","configuration","validation","deprecated-fields"],"backgroundTag":"config-conflict","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"}