hashicorp/nomad · error
Invalid Config, event_buffer_size must be non-negative
Error message
Invalid Config, event_buffer_size must be non-negative
What it means
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.
Source
Thrown at command/agent/agent.go:329
}
if agentConfig.Sentinel != nil {
conf.SentinelConfig = agentConfig.Sentinel
}
if agentConfig.Server.NonVotingServer {
conf.NonVoter = true
}
if agentConfig.Server.RedundancyZone != "" {
conf.RedundancyZone = agentConfig.Server.RedundancyZone
}
if agentConfig.Server.UpgradeVersion != "" {
conf.UpgradeVersion = agentConfig.Server.UpgradeVersion
}
if agentConfig.Server.EnableEventBroker != nil {
conf.EnableEventBroker = *agentConfig.Server.EnableEventBroker
}
if agentConfig.Server.EventBufferSize != nil {
if *agentConfig.Server.EventBufferSize < 0 {
return nil, fmt.Errorf("Invalid Config, event_buffer_size must be non-negative")
}
conf.EventBufferSize = int64(*agentConfig.Server.EventBufferSize)
}
if agentConfig.Autopilot != nil {
if agentConfig.Autopilot.CleanupDeadServers != nil {
conf.AutopilotConfig.CleanupDeadServers = *agentConfig.Autopilot.CleanupDeadServers
}
if agentConfig.Autopilot.ServerStabilizationTime != 0 {
conf.AutopilotConfig.ServerStabilizationTime = agentConfig.Autopilot.ServerStabilizationTime
}
if agentConfig.Autopilot.LastContactThreshold != 0 {
conf.AutopilotConfig.LastContactThreshold = agentConfig.Autopilot.LastContactThreshold
}
if agentConfig.Autopilot.MaxTrailingLogs != 0 {
conf.AutopilotConfig.MaxTrailingLogs = uint64(agentConfig.Autopilot.MaxTrailingLogs)
}
if agentConfig.Autopilot.MinQuorum != 0 {
conf.AutopilotConfig.MinQuorum = uint(agentConfig.Autopilot.MinQuorum)View on GitHub (pinned to 482b49bf1a)
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.
Example fix
// before
server {
event_buffer_size = -100
}
// after
server {
event_buffer_size = 100
} Defensive patterns
Strategy: validation
Validate before calling
// Go: pre-validate
if v := cfg.Server.EventBufferSize; v != nil && *v < 0 {
return fmt.Errorf("event_buffer_size must be >= 0")
} Try / catch
conf, err := convertServerConfig(agentCfg)
if err != nil {
if strings.Contains(err.Error(), "event_buffer_size") {
return fmt.Errorf("event_buffer_size must be non-negative: %w", err)
}
return err
} Prevention
- 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.
When it happens
Trigger: Setting server { event_buffer_size = -1 } (any negative int64) in agent config, then starting the agent or reloading it (serverConfig, handleReload, tests).
Common situations: Signed arithmetic or templating bugs producing negative buffer values; misunderstanding the option as an auto-size hint; copy-paste with a leading dash.
Related errors
- wait config is nil or empty
- missing datacenter for client registration
- default_identity_ttl must be greater than 0
- max_identity_ttl must be greater than 0
- max_identity_ttl must be greater than or equal to default_id
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/0b8839e10a66177a.
Report an issue: GitHub.