{"record":{"id":"2825bdf135c71ff3","repo":"hashicorp/nomad","slug":"failed-to-parse-start-timeout-v","errorCode":null,"errorMessage":"failed to parse start_timeout: %v","messagePattern":"failed to parse start_timeout: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/agent.go","lineNumber":719,"sourceCode":"\tif agentConfig.Server.JobMaxSourceSize == nil {\n\t\tagentConfig.Server.JobMaxSourceSize = new(\"1M\")\n\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 {","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/agent.go#L701-L737","documentation":"convertServerConfig parses server.start_timeout with time.ParseDuration and rejects it if unparsable or non-positive (\"start_timeout should be greater than 0s\" follows immediately for the latter). This timeout bounds how long the server waits during startup; an invalid value would silently disable or break that bound, so it fails fast.","triggerScenarios":"start_timeout set to a string time.ParseDuration rejects (\"30\", \"5min\", \"half-minute\") or to zero/negative after parsing (\"0s\", \"-10s\"). Triggered at agent start or SIGHUP reload through serverConfig/handleReload.","commonSituations":"Omitting the unit (\"300\" meaning seconds); using non-Go duration syntax like \"5m30s\" is fine but \"5 minutes\" is not; template injection producing \"0s\" or empty-adjacent values; operators trying to disable the timeout with 0 and hitting the positivity check.","solutions":["Set start_timeout to a positive Go duration with a unit, e.g. start_timeout = \"30s\".","Ensure zero/negative values are replaced with a positive duration (0 is explicitly rejected).","If a variable feeds this field, render and `nomad validate` the config to confirm the final value.","Remove the key to accept the default timeout if no custom value is required."],"exampleFix":"// before\nserver {\n  start_timeout = \"0s\"\n}\n// after\nserver {\n  start_timeout = \"30s\"\n}","handlingStrategy":"validation","validationCode":"d, err := time.ParseDuration(startTimeout)\nif err != nil {\n    return fmt.Errorf(\"start_timeout %q is not a valid Go duration: %v\", startTimeout, err)\n}\nif d <= 0 {\n    return fmt.Errorf(\"start_timeout must be > 0s\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use explicit units: \"30s\", \"2m\" — never a bare number.","Never set 0s or negative values; the field must be positive.","Validate rendered configs with `nomad validate` before restart or reload."],"tags":["nomad","config-validation","duration-parsing","server-config"],"backgroundTag":"invalid-duration-format","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"}