{"record":{"id":"0b8839e10a66177a","repo":"hashicorp/nomad","slug":"invalid-config-event-buffer-size-must-be-non-nega","errorCode":null,"errorMessage":"Invalid Config, event_buffer_size must be non-negative","messagePattern":"Invalid Config, event_buffer_size must be non-negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/agent/agent.go","lineNumber":329,"sourceCode":"\t}\n\tif agentConfig.Sentinel != nil {\n\t\tconf.SentinelConfig = agentConfig.Sentinel\n\t}\n\tif agentConfig.Server.NonVotingServer {\n\t\tconf.NonVoter = true\n\t}\n\tif agentConfig.Server.RedundancyZone != \"\" {\n\t\tconf.RedundancyZone = agentConfig.Server.RedundancyZone\n\t}\n\tif agentConfig.Server.UpgradeVersion != \"\" {\n\t\tconf.UpgradeVersion = agentConfig.Server.UpgradeVersion\n\t}\n\tif agentConfig.Server.EnableEventBroker != nil {\n\t\tconf.EnableEventBroker = *agentConfig.Server.EnableEventBroker\n\t}\n\tif agentConfig.Server.EventBufferSize != nil {\n\t\tif *agentConfig.Server.EventBufferSize < 0 {\n\t\t\treturn nil, fmt.Errorf(\"Invalid Config, event_buffer_size must be non-negative\")\n\t\t}\n\t\tconf.EventBufferSize = int64(*agentConfig.Server.EventBufferSize)\n\t}\n\tif agentConfig.Autopilot != nil {\n\t\tif agentConfig.Autopilot.CleanupDeadServers != nil {\n\t\t\tconf.AutopilotConfig.CleanupDeadServers = *agentConfig.Autopilot.CleanupDeadServers\n\t\t}\n\t\tif agentConfig.Autopilot.ServerStabilizationTime != 0 {\n\t\t\tconf.AutopilotConfig.ServerStabilizationTime = agentConfig.Autopilot.ServerStabilizationTime\n\t\t}\n\t\tif agentConfig.Autopilot.LastContactThreshold != 0 {\n\t\t\tconf.AutopilotConfig.LastContactThreshold = agentConfig.Autopilot.LastContactThreshold\n\t\t}\n\t\tif agentConfig.Autopilot.MaxTrailingLogs != 0 {\n\t\t\tconf.AutopilotConfig.MaxTrailingLogs = uint64(agentConfig.Autopilot.MaxTrailingLogs)\n\t\t}\n\t\tif agentConfig.Autopilot.MinQuorum != 0 {\n\t\t\tconf.AutopilotConfig.MinQuorum = uint(agentConfig.Autopilot.MinQuorum)","sourceCodeStart":311,"sourceCodeEnd":347,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/agent/agent.go#L311-L347","documentation":"Returned by convertServerConfig when the server's event_buffer_size setting is negative. The event broker buffer must hold zero or more events, so a negative size is rejected during agent config conversion/reload.","triggerScenarios":"Setting server { event_buffer_size = -1 } (any negative int64) in agent config, then starting the agent or reloading it (serverConfig, handleReload, tests).","commonSituations":"Signed arithmetic or templating bugs producing negative buffer values; misunderstanding the option as an auto-size hint; copy-paste with a leading dash.","solutions":["Set event_buffer_size to 0 (use default) or a positive number of events.","Remove the stanza to use the default buffer size.","Check any config generation logic for sign errors."],"exampleFix":"// before\nserver {\n  event_buffer_size = -100\n}\n// after\nserver {\n  event_buffer_size = 100\n}","handlingStrategy":"validation","validationCode":"// Go: pre-validate\nif v := cfg.Server.EventBufferSize; v != nil && *v < 0 {\n    return fmt.Errorf(\"event_buffer_size must be >= 0\")\n}","typeGuard":null,"tryCatchPattern":"conf, err := convertServerConfig(agentCfg)\nif err != nil {\n    if strings.Contains(err.Error(), \"event_buffer_size\") {\n        return fmt.Errorf(\"event_buffer_size must be non-negative: %w\", err)\n    }\n    return err\n}","preventionTips":["Use 0 or positive values only; omit the option for the default.","Audit config templating for signed-int errors.","Note the check runs on reload too — validate before SIGHUP."],"tags":["nomad","events","config","validation"],"backgroundTag":"config-value-out-of-range","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"}