kubernetes/kops · error
error walking over %T: %w
Error message
error walking over %T: %w
What it means
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.
Source
Thrown at pkg/model/components/kubescheduler/model.go:195
}
// Clear the field, so we don't set the flag
val.Set(reflect.Zero(val.Type()))
default:
if err := setValue(targetPath, val.Interface()); err != nil {
return err
}
// Clear the field, so we don't set the flag
empty := reflect.New(val.Type()).Elem()
val.Set(empty)
}
}
return reflectutils.SkipReflection
}
err := reflectutils.ReflectRecursive(reflect.ValueOf(options), walker, &reflectutils.ReflectOptions{DeprecatedDoubleVisit: true, JSONNames: true})
if err != nil {
return fmt.Errorf("error walking over %T: %w", options, err)
}
return nil
}
View on GitHub (pinned to 4c8573c808)
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.
Example fix
// before // inspecting only the outer message: "error walking over *kops.KubeSchedulerConfig" // after // check wrapped cause: kops get cluster -o yaml | grep -A5 kubeScheduler -> fix invalid quantity
Defensive patterns
Strategy: try-catch
Validate before calling
if schedulerOptions == nil { return errors.New("kubeScheduler options must be initialized before MapToUnstructured") } Type guard
func isWalkError(err error) bool { return err != nil && strings.Contains(err.Error(), "error walking over") } Try / catch
if err := MapToUnstructured(opts, &target); err != nil {
var wrapped error
if errors.As(err, &wrapped) || errors.Unwrap(err) != nil {
log.Printf("scheduler walk root cause: %v", errors.Unwrap(err))
}
return err
} Prevention
- 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).
When it happens
Trigger: 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.
Common situations: Building a cluster with unusual scheduler flag/resource values in the spec; running unit tests like Test_MapToUnstructured_WithQpsAndBurst with malformed inputs.
Related errors
- unable to convert from Quantity %v to float
- listing secrets %v
- getting secret %q: %v
- error building kube-scheduler pod: %v
- error marshaling pod to yaml: %v
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/d88535f63f87abb5.
Report an issue: GitHub.