argoproj/argo-workflows · error

failed to patch TaskSet. %w

Error message

failed to patch TaskSet. %w

What it means

createTaskSet failed to patch the WorkflowTaskSet CR with the task templates via mergePatchTaskSet. The patch (merge of spec.tasks) was rejected or the API call errored, so the task set cannot carry HTTP/plugin templates for this workflow.

Source

Thrown at workflow/controller/taskset.go:222

	woc.log.Debug(ctx, "creating new taskset")

	_, err := woc.controller.wfclientset.ArgoprojV1alpha1().WorkflowTaskSets(woc.wf.Namespace).Create(ctx, &taskSet, metav1.CreateOptions{})

	if apierr.IsConflict(err) || apierr.IsAlreadyExists(err) {
		woc.log.Debug(ctx, "patching the exiting taskset")
		spec := map[string]any{
			"metadata": metav1.ObjectMeta{
				Labels: map[string]string{
					common.LabelKeyCompleted: strconv.FormatBool(woc.wf.Status.Fulfilled()),
				},
			},
			"spec": wfv1.WorkflowTaskSetSpec{Tasks: woc.taskSet},
		}
		// patch the new templates into taskset
		err = woc.mergePatchTaskSet(ctx, spec)
		if err != nil {
			woc.log.WithError(err).Error(ctx, "Failed to patch WorkflowTaskSet")
			return fmt.Errorf("failed to patch TaskSet. %w", err)
		}
	} else if err != nil {
		woc.log.WithError(err).Error(ctx, "Failed to create WorkflowTaskSet")
		return err
	}
	return nil
}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Verify the WorkflowTaskSet CRD is installed and matches your controller version (apply manifests/base/crds)
  2. Check controller RBAC allows patch on workflowtasksets.argoproj.io
  3. Retry; if conflict errors persist, check for multiple controllers reconciling the same workflow
  4. Check the wrapped error in 'Failed to patch WorkflowTaskSet' log for the API server's reason
Defensive patterns

Strategy: retry

Validate before calling

// ensure CRD exists and is current
kubectl get crd workflowtasksets.argoproj.io
kubectl auth can-i patch workflowtasksets.argoproj.io --as=system:serviceaccount:<ns>:<controller-sa>

Try / catch

// retry with backoff on patch errors
if err := woc.mergePatchTaskSet(ctx, spec); err != nil {
    return fmt.Errorf("failed to patch TaskSet. %w", err)
} // requeue and retry on conflict/transient errors

Prevention

When it happens

Trigger: mergePatchTaskSet returns an error from the Kubernetes API while patching the WorkflowTaskSet spec — e.g. the TaskSet CRD is missing/outdated, the object was modified concurrently (conflict), or the patch payload is invalid.

Common situations: Upgrading Argo Workflows without applying the new WorkflowTaskSet CRD; RBAC blocking patch on workflowtasksets; API server transient errors or conflicts during high reconciliation load.

Related errors


AI-assisted analysis of argoproj/argo-workflows@35bff19146 (2026-09-03). Data as JSON: /api/errors/c6e998b04d9f9846. Report an issue: GitHub.