{"record":{"id":"ccafc9a806f5d7dc","repo":"hashicorp/nomad","slug":"rcp-connection-write-timeout-must-be-greater-than","errorCode":null,"errorMessage":"rcp.connection_write_timeout must be greater than zero","messagePattern":"rcp\\.connection_write_timeout must be greater than zero","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":965,"sourceCode":"\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\n\treturn nil\n}\n\n// RaftBoltConfig is used in servers to configure parameters of the boltdb\n// used for raft consensus.\ntype RaftBoltConfig struct {","sourceCodeStart":947,"sourceCodeEnd":983,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L947-L983","documentation":"Returned by RPCConfig.Validate() in command/agent/config.go when rpc.connection_write_timeout is negative. This timeout bounds how long the agent waits to write to an RPC connection; the validator rejects only negative durations at config load time. The 'rcp.' prefix in the message is a typo for 'rpc.'.","triggerScenarios":"Setting `rpc { connection_write_timeout = -1s }` in server/client agent config, or building RPCConfig programmatically with a negative ConnectionWriteTimeout before calling Validate().","commonSituations":"Mistyped duration values in agent configs; templating systems interpolating negative values; misunderstanding that a negative value disables the timeout (it does not — omit or use zero instead).","solutions":["Set rpc.connection_write_timeout to zero or a positive duration (e.g. \"10s\")","Remove the field to fall back to the default write timeout","Correct any automation that computes this timeout so it never emits negatives"],"exampleFix":"// before\nrpc { connection_write_timeout = -10s }\n// after\nrpc { connection_write_timeout = 10s }","handlingStrategy":"validation","validationCode":"if cfg.RPC != nil && cfg.RPC.ConnectionWriteTimeout < 0 {\n\treturn fmt.Errorf(\"rpc.connection_write_timeout must be >= 0\")\n}","typeGuard":"func validWriteTimeout(r *RPCConfig) bool {\n\treturn r == nil || r.ConnectionWriteTimeout >= 0\n}","tryCatchPattern":"if err := rpcCfg.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"connection_write_timeout\") {\n\t\trpcCfg.ConnectionWriteTimeout = 10 * time.Second\n\t}\n\treturn err\n}","preventionTips":["Treat all rpc timeouts as non-negative durations; drop the key for defaults","Run `nomad agent` config validation in pipelines before rollout","Avoid computing timeouts from values that can go negative (e.g. subtractions)"],"tags":["config","validation","nomad-agent","rpc","timeout"],"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"}