kubernetes/kops · error
BuildFlagsList to reflect value: %s
Error message
BuildFlagsList to reflect value: %s
What it means
BuildConfigYaml walks the options struct with reflectutils.ReflectRecursive to copy tagged fields into the target config. This error wraps any failure returned by that recursive reflection (including walker errors like the conversion errors above). It is the top-level wrapper meaning "reflecting the options struct into the config file failed".
Source
Thrown at pkg/configbuilder/buildconfigfile.go:81
}
}
switch v := val.Interface().(type) {
case *resource.Quantity:
floatVal, err := strconv.ParseFloat(v.AsDec().String(), 64)
if err != nil {
return fmt.Errorf("unable to convert from Quantity %v to float", v)
}
targetValue.Set(reflect.ValueOf(&floatVal))
default:
targetValue.Set(val)
}
return reflectutils.SkipReflection
}
err := reflectutils.ReflectRecursive(reflect.ValueOf(options), walker, &reflectutils.ReflectOptions{DeprecatedDoubleVisit: true})
if err != nil {
return nil, fmt.Errorf("BuildFlagsList to reflect value: %s", err)
}
configFile, err := yaml.Marshal(target)
if err != nil {
return nil, err
}
return configFile, nil
}
func getValueFromStruct(keyWithDots string, object interface{}) (*reflect.Value, error) {
keySlice := strings.Split(keyWithDots, ".")
v := reflect.ValueOf(object)
// iterate through field names, ignoring the first name as it might be the current instance name
// you can make it recursive also if want to support types like slice,map etc along with struct
for _, key := range keySlice {
for v.Kind() == reflect.Ptr {
v = v.Elem()View on GitHub (pinned to 4c8573c808)
Solutions
- Read the wrapped (%s) inner error to identify which field's conversion or traversal failed
- Fix the offending configfile tag or target struct field indicated by the inner error
- Run the existing tests (TestParseDefault/TestParse, TestRewriteChannelsManifestForEnroll-style coverage) for BuildConfigYaml to reproduce locally
- If reflectutils traversal itself fails on a new type, add a `configfile:"-"` tag to skip that subtree
Example fix
// before
err := reflectutils.ReflectRecursive(reflect.ValueOf(options), walker, &reflectutils.ReflectOptions{DeprecatedDoubleVisit: true})
if err != nil {
return nil, fmt.Errorf("BuildFlagsList to reflect value: %s", err)
}
// after
err := reflectutils.ReflectRecursive(reflect.ValueOf(options), walker, &reflectutils.ReflectOptions{DeprecatedDoubleVisit: true})
if err != nil {
return nil, fmt.Errorf("building scheduler config from options: %w", err)
} Defensive patterns
Strategy: try-catch
Try / catch
cfg, err := configbuilder.BuildConfigYaml(options, target)
if err != nil {
if strings.Contains(err.Error(), "BuildFlagsList to reflect value") {
// log the wrapped inner cause to find the offending field/tag
return nil, fmt.Errorf("config build failed: %w", err)
}
return nil, err
} Prevention
- Keep KubeSchedulerConfig tags and the target component-config struct versioned together
- Run TestParse/TestParseDefault whenever either struct changes
- Use %w instead of %s in wrappers so callers can errors.As/errors.Is on inner causes
- Skip unsupported subtrees with configfile:"-" tags before they reach the reflection walk
When it happens
Trigger: Any walker error during ReflectRecursive over *kops.KubeSchedulerConfig — e.g. a configfile tag naming a missing target field, an invalid Quantity conversion, or reflectutils failing to traverse an unsupported type in the options tree.
Common situations: Generating kube-scheduler component config during `kops toolbox`/cluster rendering after a field or tag mismatch was introduced in KubeSchedulerConfig; upstream component-config type changes breaking the tag-to-target mapping.
Related errors
- conversion error for field %s: %s
- unable to convert from Quantity %v to float
- only accepts structs; got %T
- CAPI Machine is missing cluster.x-k8s.io/deployment-name lab
- CAPI Machine is missing spec.failureDomain
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/027faecd0db9d3cc.
Report an issue: GitHub.