cilium/cilium · error

failed to add custom sysdump tasks: %w

Error message

failed to add custom sysdump tasks: %w

What it means

NewCollector fails when hooks.AddSysdumpTasks(c) returns an error while registering custom/extension sysdump tasks (e.g. hooks provided to the collector).

Source

Thrown at cilium-cli/sysdump/sysdump.go:349

		}
		if c.CiliumConfigMap != nil {
			c.FeatureSet.ExtractFromConfigMap(c.CiliumConfigMap)
			c.log("🔮 Detected Cilium features: %v", c.FeatureSet)
		}
	}

	if c.Options.CiliumOperatorNamespace != "" {
		pods, err := c.Client.ListPods(context.Background(), c.Options.CiliumOperatorNamespace, metav1.ListOptions{
			LabelSelector: c.Options.CiliumOperatorLabelSelector,
		})
		if err != nil {
			return nil, fmt.Errorf("failed to get Cilium operator pods: %w", err)
		}
		c.CiliumOperatorPods = AllPods(pods)
	}

	if err := hooks.AddSysdumpTasks(c); err != nil {
		return nil, fmt.Errorf("failed to add custom sysdump tasks: %w", err)
	}

	return c, nil
}

// GatherResourceUnstructured queries resources with the given GroupVersionResource, storing them in the file specified by fname.
// If keep is non-empty; then it will filter the items returned, keeping only those with names listed in keep.
// If keep is empty, it will not filter the resources returned.
func (c *Collector) GatherResourceUnstructured(ctx context.Context, r schema.GroupVersionResource, fname string, keep ...string) error {
	n := corev1.NamespaceAll
	v, err := c.Client.ListUnstructured(ctx, r, &n, metav1.ListOptions{})
	if err != nil {
		return fmt.Errorf("failed to collect %s (%s): %w", r.Resource, r.Version, err)
	}

	filtered := &unstructured.UnstructuredList{
		Object: v.Object,
	}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Review the hook's error message (wrapped via %w) for root cause
  2. Validate hook configuration/task names for duplicates
  3. Update cilium-cli and the hook to compatible versions
  4. Temporarily disable custom hooks to isolate the failure

Example fix

// before
collector, err := sysdump.NewCollector(..., hooks)
// after
if err := hooks.Validate(); err != nil { log.Fatal(err) } // pre-check hooks
collector, err := sysdump.NewCollector(..., hooks)
Defensive patterns

Strategy: try-catch

Validate before calling

// if hooks are configurable, dry-run registration first
if v, ok := hookProvider.(interface{ Validate() error }); ok {
    if err := v.Validate(); err != nil { return err }
}

Type guard

null

Try / catch

c, err := sysdump.NewCollector(ctx, client, opts)
if err != nil {
    if strings.Contains(err.Error(), "custom sysdump tasks") {
        return fmt.Errorf("hook problem: %w — run without hooks to isolate", err)
    }
    return err
}

Prevention

When it happens

Trigger: Passing a hooks provider whose AddSysdumpTasks implementation errors — duplicate task names, invalid hook configuration, or panics recovered as errors in the hook.

Common situations: Custom enterprise hooks (e.g. Isovalent hooks) misconfigured, hook binary/plugin incompatible with current cilium-cli version.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/e059fb5ebc585519. Report an issue: GitHub.