{"record":{"id":"e059fb5ebc585519","repo":"cilium/cilium","slug":"failed-to-add-custom-sysdump-tasks-w","errorCode":null,"errorMessage":"failed to add custom sysdump tasks: %w","messagePattern":"failed to add custom sysdump tasks: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cilium-cli/sysdump/sysdump.go","lineNumber":349,"sourceCode":"\t\t}\n\t\tif c.CiliumConfigMap != nil {\n\t\t\tc.FeatureSet.ExtractFromConfigMap(c.CiliumConfigMap)\n\t\t\tc.log(\"🔮 Detected Cilium features: %v\", c.FeatureSet)\n\t\t}\n\t}\n\n\tif c.Options.CiliumOperatorNamespace != \"\" {\n\t\tpods, err := c.Client.ListPods(context.Background(), c.Options.CiliumOperatorNamespace, metav1.ListOptions{\n\t\t\tLabelSelector: c.Options.CiliumOperatorLabelSelector,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get Cilium operator pods: %w\", err)\n\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}","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/cilium-cli/sysdump/sysdump.go#L331-L367","documentation":"NewCollector fails when hooks.AddSysdumpTasks(c) returns an error while registering custom/extension sysdump tasks (e.g. hooks provided to the collector).","triggerScenarios":"Passing a hooks provider whose AddSysdumpTasks implementation errors — duplicate task names, invalid hook configuration, or panics recovered as errors in the hook.","commonSituations":"Custom enterprise hooks (e.g. Isovalent hooks) misconfigured, hook binary/plugin incompatible with current cilium-cli version.","solutions":["Review the hook's error message (wrapped via %w) for root cause","Validate hook configuration/task names for duplicates","Update cilium-cli and the hook to compatible versions","Temporarily disable custom hooks to isolate the failure"],"exampleFix":"// before\ncollector, err := sysdump.NewCollector(..., hooks)\n// after\nif err := hooks.Validate(); err != nil { log.Fatal(err) } // pre-check hooks\ncollector, err := sysdump.NewCollector(..., hooks)","handlingStrategy":"try-catch","validationCode":"// if hooks are configurable, dry-run registration first\nif v, ok := hookProvider.(interface{ Validate() error }); ok {\n    if err := v.Validate(); err != nil { return err }\n}","typeGuard":"null","tryCatchPattern":"c, err := sysdump.NewCollector(ctx, client, opts)\nif err != nil {\n    if strings.Contains(err.Error(), \"custom sysdump tasks\") {\n        return fmt.Errorf(\"hook problem: %w — run without hooks to isolate\", err)\n    }\n    return err\n}","preventionTips":["Keep hook implementations aligned with cilium-cli versions","Use unique task names in custom hooks","Test hooks in CI before production use","Log hook configuration at startup"],"tags":["hooks","extension","go"],"backgroundTag":"sysdump-hook-registration-failed","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}