{"record":{"id":"d545508167b21d4f","repo":"hashicorp/nomad","slug":"rcp-accept-backlog-interval-must-be-greater-than-z","errorCode":null,"errorMessage":"rcp.accept_backlog interval must be greater than zero","messagePattern":"rcp\\.accept_backlog interval must be greater than zero","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":959,"sourceCode":"\tif rpc.StreamCloseTimeoutHCL != \"\" {\n\t\tresult.StreamCloseTimeoutHCL = rpc.StreamCloseTimeoutHCL\n\t}\n\tif rpc.StreamCloseTimeout > 0 {\n\t\tresult.StreamCloseTimeout = rpc.StreamCloseTimeout\n\t}\n\tif rpc.DialTimeoutHCL != \"\" {\n\t\tresult.DialTimeoutHCL = rpc.DialTimeoutHCL\n\t}\n\tif rpc.DialTimeout > 0 {\n\t\tresult.DialTimeout = rpc.DialTimeout\n\t}\n\treturn &result\n}\n\nfunc (r *RPCConfig) Validate() error {\n\tif r != nil {\n\t\tif r.AcceptBacklog < 0 {\n\t\t\treturn errors.New(\"rcp.accept_backlog interval must be greater than zero\")\n\t\t}\n\t\tif r.KeepAliveInterval < 0 {\n\t\t\treturn errors.New(\"rcp.keep_alive_interval must be greater than zero\")\n\t\t}\n\t\tif r.ConnectionWriteTimeout < 0 {\n\t\t\treturn errors.New(\"rcp.connection_write_timeout must be greater than zero\")\n\t\t}\n\t\tif r.StreamCloseTimeout < 0 {\n\t\t\treturn errors.New(\"rcp.stream_close_timeout must be greater than zero\")\n\t\t}\n\t\tif r.StreamOpenTimeout < 0 {\n\t\t\treturn errors.New(\"rcp.stream_open_timeout must be greater than zero\")\n\t\t}\n\t\tif r.DialTimeout < 0 {\n\t\t\treturn errors.New(\"rpc.dial_timeout must be greater than or equal to zero\")\n\t\t}\n\t}\n","sourceCodeStart":941,"sourceCodeEnd":977,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L941-L977","documentation":"Returned by RPCConfig.Validate() in command/agent/config.go when the agent config's rpc.accept_backlog is negative. The validator only rejects values < 0; zero and positives pass. The message text is misleading ('interval', though it is a backlog size) and the 'rcp' prefix is a historical typo for 'rpc'.","triggerScenarios":"Setting `rpc { accept_backlog = -1 }` (or any negative value) in an agent config file, via -rpc-accept-backlog style CLI flags mapped into RPCConfig, or programmatically building a Config with a negative AcceptBacklog before agent startup.","commonSituations":"Copy-pasted config snippets with negative values; templating/config management (HCL/JSON templates) computing an expression that evaluates negative; hand-editing configs assuming the field accepts -1 as 'unlimited'.","solutions":["Set rpc.accept_backlog to a non-negative integer (0 or greater)","Remove the explicit value to use Nomad's default backlog size","If a template computed the value, fix the expression so it cannot go negative"],"exampleFix":"// before (HCL)\nrpc {\n  accept_backlog = -1\n}\n// after\nrpc {\n  accept_backlog = 128\n}","handlingStrategy":"validation","validationCode":"if cfg.RPC != nil && cfg.RPC.AcceptBacklog < 0 {\n\treturn fmt.Errorf(\"rpc.accept_backlog must be >= 0\")\n}","typeGuard":"func validRPCBacklog(r *RPCConfig) bool {\n\treturn r == nil || r.AcceptBacklog >= 0\n}","tryCatchPattern":"if err := rpcCfg.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"accept_backlog\") {\n\t\trpcCfg.AcceptBacklog = 128 // reset to safe default\n\t}\n\treturn err\n}","preventionTips":["Never use negative numbers to mean 'unlimited'; omit the key for defaults","Lint agent HCL/JSON configs before deploy (nomad agent -config with validation)","Constrain template expressions so computed values are clamped at 0"],"tags":["config","validation","nomad-agent","rpc"],"backgroundTag":"invalid-agent-config-value","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"}