{"record":{"id":"fa61c3e774697b41","repo":"kubernetes/kops","slug":"getting-gvr-namespaces-w","errorCode":null,"errorMessage":"getting GVR namespaces: %w","messagePattern":"getting GVR namespaces: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/dump/resourcedumper.go","lineNumber":123,"sourceCode":"\t\treturn fmt.Errorf(\"listing namespaces: %w\", err)\n\t}\n\n\tdiscoveryClient, err := discovery.NewDiscoveryClientForConfig(d.k8sConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"creating discovery client: %w\", err)\n\t}\n\n\tresourceLists, err := discoveryClient.ServerPreferredResources()\n\tvar discoveryErr *discovery.ErrGroupDiscoveryFailed\n\tif errors.As(err, &discoveryErr) {\n\t\tklog.Warningf(\"using incomplete list of API groups: %v\", discoveryErr)\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"listing server preferred resources: %w\", err)\n\t}\n\n\tgvrNamespaces, err := getGVRNamespaces(resourceLists, namespaces.Items)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting GVR namespaces: %w\", err)\n\t}\n\n\tjobs := make(chan gvrNamespace, len(gvrNamespaces))\n\tresults := make(chan resourceDumpResult, len(gvrNamespaces))\n\n\tfor i := 0; i < resourceDumpConcurrency; i++ {\n\t\tgo d.dumpGVRNamespaces(ctx, jobs, results)\n\t}\n\n\tvar dumpErr error\n\n\tfor _, gvrn := range gvrNamespaces {\n\t\tjobs <- gvrn\n\t}\n\tclose(jobs)\n\n\tfor i := 0; i < len(gvrNamespaces); i++ {\n\t\tresult := <-results","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/dump/resourcedumper.go#L105-L141","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func isParseGroupVersionError(err error) bool {\n\t// ParseGroupVersion returns a plain error naming the bad GroupVersion string\n\tvar pge *schema.GroupVersion\n\t_ = pge\n\treturn err != nil && strings.Contains(err.Error(), \"unexpected GroupVersion string\")\n}","tryCatchPattern":"if err := dumper.DumpResources(ctx); err != nil {\n\tif strings.Contains(err.Error(), \"getting GVR namespaces\") {\n\t\t// discovery payload has a malformed group-version:\n\t\t// identify and remove/fix the offending aggregated API server or CRD\n\t}\n\treturn err\n}","preventionTips":["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."],"tags":["kubernetes","discovery","schema"],"backgroundTag":"invalid-group-version","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"}