vitessio/vitess · error
--buffer-window must be <= --buffer-max-failover-duration: %
Error message
--buffer-window must be <= --buffer-max-failover-duration: %v vs. %v
What it means
verifyFlags enforces that the buffering window (--buffer-window) is not larger than the maximum failover duration (--buffer-max-failover-duration). Buffering stops after the max failover duration, so a window exceeding it is contradictory configuration and vtgate rejects it at startup.
Source
Thrown at go/vt/vtgate/buffer/flags.go:70
utils.SetFlagIntVar(fs, &bufferSize, "buffer-size", 1000, "Maximum number of buffered requests in flight (across all ongoing failovers).")
utils.SetFlagDurationVar(fs, &bufferMaxFailoverDuration, "buffer-max-failover-duration", 20*time.Second, "Stop buffering completely if a failover takes longer than this duration.")
utils.SetFlagDurationVar(fs, &bufferMinTimeBetweenFailovers, "buffer-min-time-between-failovers", 1*time.Minute, "Minimum time between the end of a failover and the start of the next one (tracked per shard). Faster consecutive failovers will not trigger buffering.")
utils.SetFlagIntVar(fs, &bufferDrainConcurrency, "buffer-drain-concurrency", 1, "Maximum number of requests retried simultaneously. More concurrency will increase the load on the PRIMARY vttablet when draining the buffer.")
utils.SetFlagStringVar(fs, &bufferKeyspaceShards, "buffer-keyspace-shards", "", "If not empty, limit buffering to these entries (comma separated). Entry format: keyspace or keyspace/shard. Requires --enable_buffer=true.")
}
func init() {
servenv.OnParseFor("vtgate", registerFlags)
servenv.OnParseFor("vtcombo", registerFlags)
}
func verifyFlags() error {
if bufferWindow < 1*time.Second {
return fmt.Errorf("--buffer-window must be >= 1s (specified value: %v)", bufferWindow)
}
if bufferWindow > bufferMaxFailoverDuration {
return fmt.Errorf("--buffer-window must be <= --buffer-max-failover-duration: %v vs. %v", bufferWindow, bufferMaxFailoverDuration)
}
if bufferSize < 1 {
return fmt.Errorf("--buffer-size must be >= 1 (specified value: %d)", bufferSize)
}
if bufferMinTimeBetweenFailovers < 1*time.Second {
return fmt.Errorf("--buffer-min-time-between-failovers must be >= 1s (specified value: %v)", bufferMinTimeBetweenFailovers)
}
if bufferDrainConcurrency < 1 {
return fmt.Errorf("--buffer-drain-concurrency must be >= 1 (specified value: %d)", bufferDrainConcurrency)
}
if bufferKeyspaceShards != "" && !bufferEnabled {
return fmt.Errorf("--buffer-keyspace-shards=%v also requires that --enable_buffer is set", bufferKeyspaceShards)
}
if bufferEnabled && bufferEnabledDryRun && bufferKeyspaceShards == "" {
return errors.New("both the dry-run mode and actual buffering is enabled. To avoid ambiguity, keyspaces and shards for actual buffering must be explicitly listed in --buffer-keyspace-shards")
}View on GitHub (pinned to 01a25a7d17)
Solutions
- Lower --buffer-window so it is <= --buffer-max-failover-duration
- Or raise --buffer-max-failover-duration (note it also caps how long buffering runs)
- Also check that --buffer-max-failover-duration >= 1s, since it must satisfy its own validation
Example fix
// before vtgate --buffer-window=60s --buffer-max-failover-duration=30s // after vtgate --buffer-window=30s --buffer-max-failover-duration=60s
Defensive patterns
Strategy: validation
Validate before calling
if bufferWindow > bufferMaxFailoverDuration {
return fmt.Errorf("--buffer-window (%v) must be <= --buffer-max-failover-duration (%v)", bufferWindow, bufferMaxFailoverDuration)
} Prevention
- Treat --buffer-window and --buffer-max-failover-duration as a pair and set them together
- Validate the combined flag set in CI before rollout
- Document the invariant window <= max-failover-duration in runbooks
When it happens
Trigger: Starting vtgate with --buffer-window greater than --buffer-max-failover-duration, e.g. --buffer-window=60s --buffer-max-failover-duration=30s.
Common situations: Increasing --buffer-window after an incident without revisiting --buffer-max-failover-duration; copying flag sets from different environments; typo swapping the two values.
Understand the failure class
Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.
Related errors
- --buffer-window must be >= 1s (specified value: %v)
- --buffer-size must be >= 1 (specified value: %d)
- --buffer-min-time-between-failovers must be >= 1s (specified
- --buffer-drain-concurrency must be >= 1 (specified value: %d
- --buffer-keyspace-shards=%v also requires that --enable_buff
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/37e1392de20b1e60.
Report an issue: GitHub.