vitessio/vitess · warning
flagutil: OptionalFlagValue has no parse function; use a con
Error message
flagutil: OptionalFlagValue has no parse function; use a constructor such as NewOptionalFlag
What it means
Returned when the zero-value OptionalFlagValue is used as a flag without one of the NewOptional* constructors, so it has no parse function registered. Construct the value with flagutil.NewOptionalBool/NewOptionalInt64/etc. instead of declaring a bare OptionalFlagValue.
Source
Thrown at go/flagutil/optional.go:124
// NewOptionalFlag returns a *OptionalFlagValue[T] with the given default value,
// pflag type name, parse function, and stringer.
// It returns an error if parse is nil, since a flag without a parse function cannot be set.
func NewOptionalFlag[T any](defaultVal T, typeName string, parse func(string) (T, error), stringer func(T) string) (*OptionalFlagValue[T], error) {
if parse == nil {
return nil, errors.New("flagutil: NewOptionalFlag requires a non-nil parse function")
}
return &OptionalFlagValue[T]{
val: defaultVal,
typeName: typeName,
parse: parse,
stringer: stringer,
}, nil
}
func (f *OptionalFlagValue[T]) Set(arg string) error {
if f.parse == nil {
return errors.New("flagutil: OptionalFlagValue has no parse function; use a constructor such as NewOptionalFlag")
}
v, err := f.parse(arg)
if err != nil {
return err
}
f.val = v
f.set = true
return nil
}
func (f *OptionalFlagValue[T]) String() string {
if f.stringer == nil {
return fmt.Sprintf("%v", f.val)
}
View on GitHub (pinned to 01a25a7d17)
Solutions
- Retry the request
- Increase topoReadPool size or throttle callers
- Diagnose topo server latency causing long slot occupancy
Defensive patterns
Strategy: retry
Try / catch
v, err := cluster.GetVSchema(ctx, ks)
if err != nil && errors.Is(err, context.DeadlineExceeded) {
v, err = cluster.GetVSchema(ctxWithRetry, ks)
} Prevention
- Serialize vschema reads or batch them via GetVSchemas
- Increase topoReadPool size
- Monitor topo read latency
When it happens
Trigger: Calling Cluster.GetVSchema while topoReadPool is exhausted and the request context expires during Acquire.
Common situations: Heavy concurrent vtadmin traffic; slow topo backend; short client deadlines.
Related errors
- value must be either a float64 (interpreted as seconds) or a
- flagutil: NewOptionalFlag requires a non-nil parse function
- invalid choice for enum
- GetVSchema(keyspace = %s): %w
- %w: keyspace %s
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/8a83e8c2a558d551.
Report an issue: GitHub.