{"record":{"id":"e2ffdfa77355bb65","repo":"hashicorp/nomad","slug":"rcp-stream-open-timeout-must-be-greater-than-zero","errorCode":null,"errorMessage":"rcp.stream_open_timeout must be greater than zero","messagePattern":"rcp\\.stream_open_timeout must be greater than zero","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/config.go","lineNumber":971,"sourceCode":"\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 {\n\t// NoFreelistSync toggles whether the underlying raft storage should sync its\n\t// freelist to disk within the bolt .db file. When disabled, IO performance\n\t// will be improved but at the expense of longer startup times.\n\t//\n\t// Default: false.\n\tNoFreelistSync bool `hcl:\"no_freelist_sync\"`","sourceCodeStart":953,"sourceCodeEnd":989,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/config.go#L953-L989","documentation":"Returned by RPCConfig.Validate() in command/agent/config.go when rpc.stream_open_timeout is negative. This timeout bounds how long the agent waits for a stream handshake to open; Validate() rejects negative durations when the agent config is loaded. The 'rcp.' prefix in the message is a typo for 'rpc.'.","triggerScenarios":"Setting `rpc { stream_open_timeout = -1s }` in agent config, or instantiating RPCConfig with a negative StreamOpenTimeout in code that runs Validate() prior to launching the agent.","commonSituations":"Typo'd signs in duration configs; infrastructure-as-code templates rendering negative numbers; users trying to disable the timeout with -1 instead of zero or omitting the key.","solutions":["Set rpc.stream_open_timeout to zero or a positive duration (e.g. \"10s\")","Remove the key so the default timeout applies","Audit config-templating code to ensure it cannot render negative durations"],"exampleFix":"// before\nrpc { stream_open_timeout = -10s }\n// after\nrpc { stream_open_timeout = 10s }","handlingStrategy":"validation","validationCode":"if cfg.RPC != nil && cfg.RPC.StreamOpenTimeout < 0 {\n\treturn fmt.Errorf(\"rpc.stream_open_timeout must be >= 0\")\n}","typeGuard":"func validStreamOpenTimeout(r *RPCConfig) bool {\n\treturn r == nil || r.StreamOpenTimeout >= 0\n}","tryCatchPattern":"if err := rpcCfg.Validate(); err != nil {\n\tif strings.Contains(err.Error(), \"stream_open_timeout\") {\n\t\trpcCfg.StreamOpenTimeout = 10 * time.Second\n\t}\n\treturn err\n}","preventionTips":["Use zero (not -1) when you want the timeout disabled where permitted","Diff generated configs against a known-good baseline before deploy","Validate agent config at boot in staging to catch sign errors early"],"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"}