kubernetes/kops · error
getting GVR namespaces: %w
Error message
getting GVR namespaces: %w
What it means
getGVRNamespaces() cross-products the discovered API resources with the namespace list to build the per-(GVR,namespace) dump jobs, and parses each resourceList.GroupVersion with schema.ParseGroupVersion. Its error is wrapped as "getting GVR namespaces: %w". In practice the only failure source is ParseGroupVersion rejecting a malformed GroupVersion string in a discovery response.
Source
Thrown at pkg/dump/resourcedumper.go:123
return fmt.Errorf("listing namespaces: %w", err)
}
discoveryClient, err := discovery.NewDiscoveryClientForConfig(d.k8sConfig)
if err != nil {
return fmt.Errorf("creating discovery client: %w", err)
}
resourceLists, err := discoveryClient.ServerPreferredResources()
var discoveryErr *discovery.ErrGroupDiscoveryFailed
if errors.As(err, &discoveryErr) {
klog.Warningf("using incomplete list of API groups: %v", discoveryErr)
} else if err != nil {
return fmt.Errorf("listing server preferred resources: %w", err)
}
gvrNamespaces, err := getGVRNamespaces(resourceLists, namespaces.Items)
if err != nil {
return fmt.Errorf("getting GVR namespaces: %w", err)
}
jobs := make(chan gvrNamespace, len(gvrNamespaces))
results := make(chan resourceDumpResult, len(gvrNamespaces))
for i := 0; i < resourceDumpConcurrency; i++ {
go d.dumpGVRNamespaces(ctx, jobs, results)
}
var dumpErr error
for _, gvrn := range gvrNamespaces {
jobs <- gvrn
}
close(jobs)
for i := 0; i < len(gvrNamespaces); i++ {
result := <-resultsView on GitHub (pinned to 4c8573c808)
Solutions
- Identify the offending GroupVersion string from the wrapped error message and find which API server/CRD publishes it.
- Remove or fix the misbehaving aggregated API server / CRD publisher.
- Update the cluster's components (a valid apiserver never emits malformed group-versions).
Defensive patterns
Strategy: type-guard
Type guard
func isParseGroupVersionError(err error) bool {
// ParseGroupVersion returns a plain error naming the bad GroupVersion string
var pge *schema.GroupVersion
_ = pge
return err != nil && strings.Contains(err.Error(), "unexpected GroupVersion string")
} Try / catch
if err := dumper.DumpResources(ctx); err != nil {
if strings.Contains(err.Error(), "getting GVR namespaces") {
// discovery payload has a malformed group-version:
// identify and remove/fix the offending aggregated API server or CRD
}
return err
} Prevention
- Keep aggregated API servers updated; malformed discovery output indicates a broken server.
- Inspect `kubectl get --raw /apis` for odd group-version strings after installing third-party operators.
- Upgrade the control plane if any component emits non-conformant discovery documents.
When it happens
Trigger: A discovery entry's GroupVersion string is malformed (not "group/version" or "v1"), making schema.ParseGroupVersion fail. This is essentially never seen against a healthy apiserver.
Common situations: A broken or third-party aggregated API server returning an invalid GroupVersion in its discovery document; proxy/middleware mangling discovery payloads; custom servers used in tests.
Related errors
- unable to find resource for %s: %w
- error querying kubernetes version: %v
- cannot parse kubernetes version %q
- error getting rest mapping for %v: %w
- unknown scope for gvk %s: %q
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/fa61c3e774697b41.
Report an issue: GitHub.