{"record":{"id":"e68d4e1740e3aae4","repo":"vitessio/vitess","slug":"invalid-choice-for-enum","errorCode":null,"errorMessage":"invalid choice for enum","messagePattern":"invalid choice for enum","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/flagutil/enum.go","lineNumber":43,"sourceCode":"\n// StringEnum provides a string-like flag value that raises an error if given a\n// value not in the set of allowed choices.\n//\n// This parse-time validation can be case-sensitive or not, depending on which\n// constructor (NewStringEnum vs NewCaseInsensitiveStringEnum) was used.\ntype StringEnum struct {\n\tname string\n\tval  string\n\n\tcaseInsensitive bool\n\tchoices         map[string]struct{}\n\tchoiceNames     []string\n\tchoiceMapper    func(string) string\n}\n\n// ErrInvalidChoice is returned when parsing a value that is not a valid choice\n// for the StringEnum flag.\nvar ErrInvalidChoice = errors.New(\"invalid choice for enum\")\n\n// NewStringEnum returns a new string enum flag with the given name, default,\n// and choices.\n//\n// Parse-time validation is case-sensitive.\nfunc NewStringEnum(name string, initialValue string, choices []string) *StringEnum {\n\treturn newStringEnum(name, initialValue, choices, false)\n}\n\n// NewCaseInsensitiveStringEnum returns a new string enum flag with the given\n// name, default, and choices.\n//\n// Parse-time validation is case-insensitive.\nfunc NewCaseInsensitiveStringEnum(name string, initialValue string, choices []string) *StringEnum {\n\treturn newStringEnum(name, initialValue, choices, true)\n}\n\nfunc newStringEnum(name string, initialValue string, choices []string, caseInsensitive bool) *StringEnum {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/flagutil/enum.go#L25-L61","documentation":"Vtadmin limits concurrent topology reads with a semaphore (topoReadPool). Before calling ShardReplicationPositions it acquires this pool; if the acquisition fails (usually because the request context was cancelled or timed out while waiting for a slot), this error is recorded for that keyspace/shard.","triggerScenarios":"Calling Cluster.GetShardReplicationPositions when many concurrent topo reads saturate topoReadPool and the caller's ctx is cancelled/times out while blocked in Acquire.","commonSituations":"Bulk UI requests fanning out over all shards at once; slow topo backends (etcd under load) holding pool slots; client timeouts shorter than pool wait time.","solutions":["Retry the request; if frequent, the topo backend is overloaded or the pool is undersized","Increase vtadmin's topo read pool size or reduce concurrent fan-out (fewer shards per request)","Check the timeout/cancellation on the client side and extend request deadlines"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {\n\t// retry with backoff or increase deadline\n\terr = cluster.GetShardReplicationPositions(ctxWithLongerTimeout, ks, shard)\n}\n// always check errors.Is(err, errors.ErrNoServingTablet) / cause for pool errors","preventionTips":["Size topoReadPool above expected concurrent fan-out","Use generous client deadlines for cluster-wide fan-out calls","Monitor etcd/zk latency that keeps pool slots busy"],"tags":["vtadmin","topology","concurrency","timeout"],"backgroundTag":"semaphore-acquire-timeout","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}