{"record":{"id":"df21fe59c7958823","repo":"hashicorp/nomad","slug":"start-timeout-should-be-greater-than-0s","errorCode":null,"errorMessage":"start_timeout should be greater than 0s","messagePattern":"start_timeout should be greater than 0s","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/agent.go","lineNumber":721,"sourceCode":"\t}\n\tjobMaxSourceBytes, err := humanize.ParseBytes(*agentConfig.Server.JobMaxSourceSize)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse max job source bytes: %w\", err)\n\t}\n\tconf.JobMaxSourceSize = int(jobMaxSourceBytes)\n\n\tconf.Reporting = agentConfig.Reporting\n\t// Pass the server's production status through to the reporting config\n\tconf.Reporting.NonProduction = agentConfig.Server.NonProduction\n\n\tconf.KEKProviderConfigs = agentConfig.KEKProviders\n\n\tif startTimeout := agentConfig.Server.StartTimeout; startTimeout != \"\" {\n\t\tdur, err := time.ParseDuration(startTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to parse start_timeout: %v\", err)\n\t\t} else if dur <= time.Duration(0) {\n\t\t\treturn nil, fmt.Errorf(\"start_timeout should be greater than 0s\")\n\t\t}\n\t\tconf.StartTimeout = dur\n\t}\n\n\t// Ensure the passed number of scheduler is between the bounds of zero and\n\t// the number of CPU cores on the machine. The runtime CPU count object is\n\t// populated at process start time, so there is no overhead in calling the\n\t// function compared to saving the value.\n\tif conf.NumSchedulers < 0 || conf.NumSchedulers > runtime.NumCPU() {\n\t\treturn nil, fmt.Errorf(\"number of schedulers should be between 0 and %d\",\n\t\t\truntime.NumCPU())\n\t}\n\n\t// If the operator has specified a client introduction server config block,\n\t// translate this into the internal server configuration object.\n\tif agentConfig.Server.ClientIntroduction != nil {\n\t\tif agentConfig.Server.ClientIntroduction.Enforcement != \"\" {\n\t\t\tconf.NodeIntroductionConfig.Enforcement = agentConfig.Server.ClientIntroduction.Enforcement","sourceCodeStart":703,"sourceCodeEnd":739,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/agent.go#L703-L739","documentation":"Nomad's convertServerConfig parses the server { start_timeout = \"...\" } agent config value with time.ParseDuration and rejects any parsed duration that is zero or negative. StartTimeout bounds how long a server waits for peers during startup, so a non-positive value is meaningless and would break startup logic. The error aborts agent configuration before the server is created.","triggerScenarios":"Setting server.start_timeout to \"0\", \"0s\", a negative value like \"-5s\", or any value that parses to dur <= 0 in the Nomad agent config, then starting the agent or triggering a reload (handleReload) that re-runs convertServerConfig.","commonSituations":"Copy-pasted config snippets with start_timeout = \"0s\" to 'disable' the timeout; templating tools substituting an empty/zero default; typos intending a large timeout; automated config generators producing negative durations from calculations.","solutions":["Set server.start_timeout to a positive duration, e.g. start_timeout = \"30s\".","Remove the start_timeout key entirely to fall back to the default value.","Verify the duration string parses with Go time.ParseDuration semantics (e.g. \"5s\", \"1m30s\")."],"exampleFix":"// before\nserver {\n  start_timeout = \"0s\"\n}\n// after\nserver {\n  start_timeout = \"30s\"\n}","handlingStrategy":"validation","validationCode":"if v, ok := cfg.Get(\"server.start_timeout\"); ok {\n  d, err := time.ParseDuration(v)\n  if err != nil || d <= 0 {\n    return fmt.Errorf(\"start_timeout must be a positive duration, got %q\", v)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a unit suffix and a positive value for start_timeout.","Add a config-lint step validating durations with time.ParseDuration and d > 0.","Prefer omitting the key over setting 0 to 'disable' it."],"tags":["config","nomad","duration-parsing"],"backgroundTag":"invalid-duration-config","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"}