{"record":{"id":"a7ab97d55d43cd33","repo":"vitessio/vitess","slug":"buffer-keyspace-shards-v-also-requires-that-e","errorCode":null,"errorMessage":"--buffer-keyspace-shards=%v also requires that --enable_buffer is set","messagePattern":"--buffer-keyspace-shards=(.+?) also requires that --enable_buffer is set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtgate/buffer/flags.go","lineNumber":84,"sourceCode":"\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}\n\t}\n\n\treturn nil\n}","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/buffer/flags.go#L66-L102","documentation":"Listing keyspace/shards in --buffer-keyspace-shards only makes sense when buffering is actually enabled with --enable_buffer. verifyFlags rejects a non-empty --buffer-keyspace-shards when buffering is disabled, because the list would silently do nothing.","triggerScenarios":"Starting vtgate with --buffer-keyspace-shards=ks1/-shard1 but without --enable_buffer (or with it explicitly false).","commonSituations":"Disabling buffering during an incident by removing --enable_buffer but leaving the shard list; stale configs where the enable flag was dropped but the list kept.","solutions":["Add --enable_buffer so the keyspace/shard list takes effect","Or remove --buffer-keyspace-shards if buffering is intentionally disabled","Check flag-precedence automation that may strip --enable_buffer while keeping other buffer flags"],"exampleFix":"// before\nvtgate --buffer-keyspace-shards=commerce/-80\n// after\nvtgate --enable_buffer --buffer-keyspace-shards=commerce/-80","handlingStrategy":"validation","validationCode":"if bufferKeyspaceShards != \"\" && !bufferEnabled {\n    return fmt.Errorf(\"--buffer-keyspace-shards=%v also requires --enable_buffer\", bufferKeyspaceShards)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When disabling buffering, remove all related flags, not just --enable_buffer","Keep buffer flags in one config block toggled together","Grep deploy manifests for orphaned buffer flags after config changes"],"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"}