{"record":{"id":"5c8723ac5fd9a766","repo":"vitessio/vitess","slug":"buffer-size-must-be-1-specified-value-d","errorCode":null,"errorMessage":"--buffer-size must be >= 1 (specified value: %d)","messagePattern":"--buffer-size must be >= 1 \\(specified value: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/buffer/flags.go","lineNumber":73,"sourceCode":"\n\tutils.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.\")\n\tutils.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.\")\n}\n\nfunc init() {\n\tservenv.OnParseFor(\"vtgate\", registerFlags)\n\tservenv.OnParseFor(\"vtcombo\", registerFlags)\n}\n\nfunc verifyFlags() error {\n\tif bufferWindow < 1*time.Second {\n\t\treturn fmt.Errorf(\"--buffer-window must be >= 1s (specified value: %v)\", bufferWindow)\n\t}\n\tif bufferWindow > bufferMaxFailoverDuration {\n\t\treturn fmt.Errorf(\"--buffer-window must be <= --buffer-max-failover-duration: %v vs. %v\", bufferWindow, bufferMaxFailoverDuration)\n\t}\n\tif bufferSize < 1 {\n\t\treturn fmt.Errorf(\"--buffer-size must be >= 1 (specified value: %d)\", bufferSize)\n\t}\n\tif bufferMinTimeBetweenFailovers < 1*time.Second {\n\t\treturn fmt.Errorf(\"--buffer-min-time-between-failovers must be >= 1s (specified value: %v)\", bufferMinTimeBetweenFailovers)\n\t}\n\n\tif bufferDrainConcurrency < 1 {\n\t\treturn fmt.Errorf(\"--buffer-drain-concurrency must be >= 1 (specified value: %d)\", bufferDrainConcurrency)\n\t}\n\n\tif bufferKeyspaceShards != \"\" && !bufferEnabled {\n\t\treturn fmt.Errorf(\"--buffer-keyspace-shards=%v also requires that --enable_buffer is set\", bufferKeyspaceShards)\n\t}\n\tif bufferEnabled && bufferEnabledDryRun && bufferKeyspaceShards == \"\" {\n\t\treturn 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\")\n\t}\n\n\tkeyspaces, shards := keyspaceShardsToSets(bufferKeyspaceShards)\n\tfor s := range shards {","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/buffer/flags.go#L55-L91","documentation":"The --buffer-size flag controls how many requests the buffer may hold during a failover. verifyFlags requires it to be at least 1; a zero or negative value is nonsensical (no buffering possible) and vtgate refuses to start.","triggerScenarios":"Starting vtgate with --buffer-size=0 or a negative number (often via automation or an env-interpolated value that evaluates to 0).","commonSituations":"Templated configs where buffer-size comes from a variable defaulting to 0; operator thinking 0 disables buffering (the correct way is to omit --enable_buffer).","solutions":["Set --buffer-size to a positive value, e.g. --buffer-size=100 (defaults to 1000)","To disable buffering entirely, do not pass --enable_buffer instead of setting size to 0","Check config templates/env vars for values interpolating to 0"],"exampleFix":"// before\nvtgate --enable_buffer --buffer-size=0\n// after\nvtgate --enable_buffer --buffer-size=100","handlingStrategy":"validation","validationCode":"if bufferSize < 1 {\n    return fmt.Errorf(\"--buffer-size must be >= 1, got %d\", bufferSize)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never use 0 to 'disable' a feature; use the dedicated enable flag","Guard templated configs against unset variables defaulting to 0","Smoke-test vtgate startup with production-like flags before rollout"],"tags":["vtgate","buffering","flag-validation","configuration"],"backgroundTag":"invalid-flag-value","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}