{"record":{"id":"7f685b4474260a43","repo":"kubernetes/kubernetes","slug":"couldn-t-list-all-objects-v","errorCode":null,"errorMessage":"Couldn't list all objects %v","messagePattern":"Couldn't list all objects (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/controller/clusterroleaggregation/clusterroleaggregation_controller.go","lineNumber":227,"sourceCode":"\terr := c.syncHandler(ctx, dsKey)\n\tif err == nil {\n\t\tc.queue.Forget(dsKey)\n\t\treturn true\n\t}\n\n\tutilruntime.HandleError(fmt.Errorf(\"%v failed with : %v\", dsKey, err))\n\tc.queue.AddRateLimited(dsKey)\n\n\treturn true\n}\n\nfunc (c *ClusterRoleAggregationController) enqueue() {\n\t// this is unusual, but since the set of all clusterroles is small and we don't know the dependency\n\t// graph, just queue up every thing each time.  This allows errors to be selectively retried if there\n\t// is a problem updating a single role\n\tallClusterRoles, err := c.clusterRoleLister.List(labels.Everything())\n\tif err != nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"Couldn't list all objects %v\", err))\n\t\treturn\n\t}\n\tfor _, clusterRole := range allClusterRoles {\n\t\t// only queue ones that we may need to aggregate\n\t\tif clusterRole.AggregationRule == nil {\n\t\t\tcontinue\n\t\t}\n\t\tkey, err := controller.KeyFunc(clusterRole)\n\t\tif err != nil {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"Couldn't get key for object %#v: %v\", clusterRole, err))\n\t\t\treturn\n\t\t}\n\t\tc.queue.Add(key)\n\t}\n}\n\ntype byName []*rbacv1.ClusterRole\n","sourceCodeStart":209,"sourceCodeEnd":245,"githubUrl":"https://github.com/kubernetes/kubernetes/blob/94c136764292cc5fac976c0de6587daaea56410f/pkg/controller/clusterroleaggregation/clusterroleaggregation_controller.go#L209-L245","documentation":"Logged by ClusterRoleAggregationController.enqueue when clusterRoleLister.List(labels.Everything()) returns an error. The lister is a local cache; an error here means the cache itself is in a bad state. After logging, enqueue returns without queueing anything, so aggregation processing stalls until the next enqueue trigger.","triggerScenarios":"enqueue() lists all ClusterRoles from the informer cache; failure occurs when the underlying store is unreachable or the cache hasn't synced (rare after WaitForNamedCacheSyncWithContext, but possible on indexer errors).","commonSituations":"Informer cache desync after a watch disconnect/reconnect storm; memory pressure corrupting the cache; very rare bug in the cache layer; the controller started before its informer factory was ready.","solutions":["Confirm cache sync completed at startup (WaitForNamedCacheSyncWithContext returned true).","Restart the kube-controller-manager pod if the cache is persistently corrupt.","Check for apiserver connectivity issues causing watch reconnects.","Monitor informer resync metrics; if resync is failing, investigate etcd/apiserver health."],"exampleFix":"// before\nallClusterRoles, err := c.clusterRoleLister.List(labels.Everything())\nif err != nil {\n    utilruntime.HandleError(fmt.Errorf(\"Couldn't list all objects %v\", err))\n    return\n}\n// after: trigger a re-enqueue on next tick so we don't stall silently\nallClusterRoles, err := c.clusterRoleLister.List(labels.Everything())\nif err != nil {\n    utilruntime.HandleError(fmt.Errorf(\"Couldn't list all objects: %v; will retry enqueue\", err))\n    c.queue.AddAfter(\"\", 30*time.Second)\n    return\n}","handlingStrategy":"retry","validationCode":"// Confirm the informer has synced before relying on List\nif !cache.WaitForCacheSync(ctx.Done(), c.clusterRolesSynced) {\n    return fmt.Errorf(\"ClusterRole cache not synced\")\n}","typeGuard":null,"tryCatchPattern":"all, err := c.clusterRoleLister.List(labels.Everything())\nif err != nil {\n    utilruntime.HandleError(fmt.Errorf(\"Couldn't list all objects %v\", err))\n    c.queue.AddAfter(\"\", 30*time.Second)\n    return\n}","preventionTips":["Ensure WaitForNamedCacheSyncWithContext completed before workers start.","Monitor informer reconnect metrics; restart the controller on persistent cache corruption.","Keep apiserver healthy to avoid watch disconnect storms."],"tags":["kubernetes-controller","rbac","clusterrole","informer-cache","retry"],"backgroundTag":null,"analyzedSha":"94c136764292cc5fac976c0de6587daaea56410f","analyzedAt":"2026-08-08T23:58:27.554Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}