{"record":{"id":"112258afca9b462f","repo":"cilium/cilium","slug":"failed-to-collect-s-s-w","errorCode":null,"errorMessage":"failed to collect %s (%s): %w","messagePattern":"failed to collect (.+?) \\((.+?)\\): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cilium-cli/sysdump/sysdump.go","lineNumber":362,"sourceCode":"\t\t}\n\t\tc.CiliumOperatorPods = AllPods(pods)\n\t}\n\n\tif err := hooks.AddSysdumpTasks(c); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to add custom sysdump tasks: %w\", err)\n\t}\n\n\treturn c, nil\n}\n\n// GatherResourceUnstructured queries resources with the given GroupVersionResource, storing them in the file specified by fname.\n// If keep is non-empty; then it will filter the items returned, keeping only those with names listed in keep.\n// If keep is empty, it will not filter the resources returned.\nfunc (c *Collector) GatherResourceUnstructured(ctx context.Context, r schema.GroupVersionResource, fname string, keep ...string) error {\n\tn := corev1.NamespaceAll\n\tv, err := c.Client.ListUnstructured(ctx, r, &n, metav1.ListOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to collect %s (%s): %w\", r.Resource, r.Version, err)\n\t}\n\n\tfiltered := &unstructured.UnstructuredList{\n\t\tObject: v.Object,\n\t}\n\t// keep everything if keep is empty\n\tif len(keep) == 0 {\n\t\tfiltered.Items = v.Items\n\t} else {\n\t\t// only save the resources which are specified by keep\n\t\tfor _, elem := range v.Items {\n\t\t\tfor _, name := range keep {\n\t\t\t\tif name == elem.GetName() {\n\t\t\t\t\tfiltered.Items = append(filtered.Items, elem)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/cilium-cli/sysdump/sysdump.go#L344-L380","documentation":"GatherResourceUnstructured fails when ListUnstructured errors while listing the given GroupVersionResource across namespaces. The resource name and version are included in the message.","triggerScenarios":"Listing a non-namespaced/all-namespace resource where the client lacks RBAC list permission, the GVR doesn't exist on the server (older cluster without the CRD), or the API group/version is wrong.","commonSituations":"Collecting cilium CRDs on a cluster where the CRD isn't installed, RBAC-restricted environments, version mismatch between cilium-cli expected resources and installed Cilium version.","solutions":["Verify the CRD/resource exists: kubectl api-resources | grep <resource>","Grant RBAC list permission on the resource group","Align cilium-cli version with the installed Cilium version","Install missing CRDs if the resource is genuinely required"],"exampleFix":"// before\ncilium-cli sysdump  # assumes ciliumnodes CRD exists\n// after\nkubectl api-resources | grep ciliumnodes || kubectl apply -f cilium-crds.yaml\ncilium-cli sysdump","handlingStrategy":"try-catch","validationCode":"// check resource availability before gathering\nres, err := discoveryClient.ServerResourcesForGroupVersion(r.Group + \"/\" + r.Version)\nif err != nil || !hasResource(res, r.Resource) {\n    return fmt.Errorf(\"resource %s not served by cluster\", r.Resource)\n}","typeGuard":"null","tryCatchPattern":"err := collector.GatherResourceUnstructured(ctx, gvr, fname)\nif err != nil {\n    var agg interface{ Unwrap() error }\n    if errors.As(err, &target) && k8serrors.IsNotFound(target) {\n        log.Printf(\"skipping missing resource %s\", gvr.Resource)\n        return nil\n    }\n    return err\n}","preventionTips":["Check kubectl api-resources for the GVRs you expect","Match cilium-cli version to cluster Cilium version","Install CRDs before sysdump","Grant list RBAC on all collected resource groups"],"tags":["kubernetes","crd","rbac","dynamic-client"],"backgroundTag":"kubernetes-resource-list-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}