{"record":{"id":"bcd2896ad79f238f","repo":"vitessio/vitess","slug":"buffer-drain-concurrency-must-be-1-specified","errorCode":null,"errorMessage":"--buffer-drain-concurrency must be >= 1 (specified value: %d)","messagePattern":"--buffer-drain-concurrency must be >= 1 \\(specified value: (.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/buffer/flags.go","lineNumber":80,"sourceCode":"\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 {\n\t\tkeyspace, _, err := topoproto.ParseKeyspaceShard(s)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif keyspaces[keyspace] {\n\t\t\treturn fmt.Errorf(\"--buffer-keyspace-shards has overlapping entries (keyspace only vs. keyspace/shard): %v vs. %v Please remove one or the other\", keyspace, s)\n\t\t}","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/buffer/flags.go#L62-L98","documentation":"--buffer-drain-concurrency is the number of goroutines used to drain buffered requests after a failover. verifyFlags requires at least 1; zero or negative values would mean buffered requests are never drained, so vtgate rejects the configuration at startup.","triggerScenarios":"Starting vtgate with --buffer-drain-concurrency=0 or negative, typically from an interpolated config value or a misunderstood '0 means default' assumption.","commonSituations":"Templating tools emitting 0 for unset variables; operators assuming 0 disables draining rather than omitting buffering altogether.","solutions":["Set --buffer-drain-concurrency to >= 1 (default is 1)","To disable buffering, omit --enable_buffer instead of zeroing the concurrency","Audit config templating/env vars that resolve to 0"],"exampleFix":"// before\nvtgate --enable_buffer --buffer-drain-concurrency=0\n// after\nvtgate --enable_buffer --buffer-drain-concurrency=1","handlingStrategy":"validation","validationCode":"if bufferDrainConcurrency < 1 {\n    return fmt.Errorf(\"--buffer-drain-concurrency must be >= 1, got %d\", bufferDrainConcurrency)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep buffer-drain-concurrency at 1+ ; scale up for faster drains, never to 0","Interpolate integers from config with strict non-zero validation","Add a startup smoke test exercising buffering flags"],"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-08T10:18:20.063Z"}