{"record":{"id":"d88535f63f87abb5","repo":"kubernetes/kops","slug":"error-walking-over-t-w","errorCode":null,"errorMessage":"error walking over %T: %w","messagePattern":"error walking over %T: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/components/kubescheduler/model.go","lineNumber":195,"sourceCode":"\t\t\t\t}\n\t\t\t\t// Clear the field, so we don't set the flag\n\t\t\t\tval.Set(reflect.Zero(val.Type()))\n\t\t\tdefault:\n\t\t\t\tif err := setValue(targetPath, val.Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t// Clear the field, so we don't set the flag\n\t\t\t\tempty := reflect.New(val.Type()).Elem()\n\t\t\t\tval.Set(empty)\n\t\t\t}\n\t\t}\n\n\t\treturn reflectutils.SkipReflection\n\t}\n\n\terr := reflectutils.ReflectRecursive(reflect.ValueOf(options), walker, &reflectutils.ReflectOptions{DeprecatedDoubleVisit: true, JSONNames: true})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error walking over %T: %w\", options, err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":177,"sourceCodeEnd":200,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/components/kubescheduler/model.go#L177-L200","documentation":"MapToUnstructured walks the kube-scheduler options struct recursively with ReflectRecursive to produce an unstructured map. Any error raised by the walker (including the Quantity conversion error above) is wrapped with this message identifying the options type. It is a wrapper, so the root cause is in the wrapped %w error.","triggerScenarios":"Calling buildSchedulerConfig / MapToUnstructured with a KubeSchedulerConfig whose fields fail reflective traversal — e.g. an invalid *resource.Quantity, or a field setter (setValue) returning an error during the walk.","commonSituations":"Building a cluster with unusual scheduler flag/resource values in the spec; running unit tests like Test_MapToUnstructured_WithQpsAndBurst with malformed inputs.","solutions":["Read the wrapped (%w) cause below this message in the log — fix the underlying walker error (usually the Quantity conversion).","Validate the kube-scheduler options in your cluster spec for malformed numeric/quantity values.","If it persists, enable kOps verbose logging to see which struct field the reflection walker failed on."],"exampleFix":"// before\n// inspecting only the outer message: \"error walking over *kops.KubeSchedulerConfig\"\n// after\n// check wrapped cause: kops get cluster -o yaml | grep -A5 kubeScheduler  -> fix invalid quantity","handlingStrategy":"try-catch","validationCode":"if schedulerOptions == nil { return errors.New(\"kubeScheduler options must be initialized before MapToUnstructured\") }","typeGuard":"func isWalkError(err error) bool { return err != nil && strings.Contains(err.Error(), \"error walking over\") }","tryCatchPattern":"if err := MapToUnstructured(opts, &target); err != nil {\n    var wrapped error\n    if errors.As(err, &wrapped) || errors.Unwrap(err) != nil {\n        log.Printf(\"scheduler walk root cause: %v\", errors.Unwrap(err))\n    }\n    return err\n}","preventionTips":["Inspect the wrapped cause (%w) with errors.Unwrap, not just the outer message.","Keep kube-scheduler config fields within values supported by your kOps/k8s versions.","Add unit tests covering all scheduler options you set (like Test_MapToUnstructured_WithQpsAndBurst)."],"tags":["reflection","kube-scheduler","wrapped-error"],"backgroundTag":"reflection-walk-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}