argoproj/argo-workflows · error

failed patching taskset: %w

Error message

failed patching taskset: %w

What it means

The controller persists WorkflowTaskSet state (aggregated task outputs for HTTP/plugin templates) via a merge patch against the WorkflowTaskSet resource. If the Kubernetes API server rejects or fails the patch, the error is wrapped as 'failed patching taskset' and the operation is retried by the controller.

Source

Thrown at workflow/controller/taskset.go:28

	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"

	argoerrors "github.com/argoproj/argo-workflows/v4/errors"
	"github.com/argoproj/argo-workflows/v4/pkg/apis/workflow"
	wfv1 "github.com/argoproj/argo-workflows/v4/pkg/apis/workflow/v1alpha1"
	"github.com/argoproj/argo-workflows/v4/util/logging"
	"github.com/argoproj/argo-workflows/v4/workflow/common"
	controllercache "github.com/argoproj/argo-workflows/v4/workflow/controller/cache"
)

func (woc *wfOperationCtx) mergePatchTaskSet(ctx context.Context, patch any, subresources ...string) error {
	patchByte, err := json.Marshal(patch)
	if err != nil {
		return argoerrors.InternalWrapError(err)
	}
	_, err = woc.controller.wfclientset.ArgoprojV1alpha1().WorkflowTaskSets(woc.wf.Namespace).Patch(ctx, woc.wf.Name, types.MergePatchType, patchByte, metav1.PatchOptions{}, subresources...)
	if err != nil {
		return fmt.Errorf("failed patching taskset: %w", err)
	}
	return nil
}

func (woc *wfOperationCtx) getDeleteTaskAndNodePatch(nodes wfv1.Nodes) (tasksPatch map[string]any, nodesPatch map[string]any) {
	deletedNode := make(map[string]any)
	for _, node := range nodes {
		if node.IsTaskSetNode() && node.Fulfilled() {
			deletedNode[node.ID] = nil
		}
	}

	// Delete the completed Tasks and nodes status
	tasksPatch = map[string]any{
		"spec": map[string]any{
			"tasks": deletedNode,
		},
	}

View on GitHub (pinned to 35bff19146)

Solutions

  1. Verify the WorkflowTaskSet CRD is installed and up to date (match controller version)
  2. Grant the controller RBAC patch rights on workflowtasksets.argoproj.io
  3. Check API server health/events; the controller retries automatically, so inspect controller logs if it keeps failing

Example fix

// before (RBAC)
rules:
  - apiGroups: [argoproj.io]
    resources: [workflowtasksets]
    verbs: [get, list, watch]
// after
rules:
  - apiGroups: [argoproj.io]
    resources: [workflowtasksets]
    verbs: [get, list, watch, create, update, patch, delete]
Defensive patterns

Strategy: retry

Validate before calling

kubectl auth can-i patch workflowtasksets.argoproj.io -n ns --as=system:serviceaccount:argo:workflow-controller

Try / catch

if strings.Contains(err.Error(), "failed patching taskset") {
    // transient API failure: rely on controller retry with backoff
}

Prevention

When it happens

Trigger: createTaskSet or removeCompletedTaskSetStatus calls mergePatchTaskSet and the Patch call on ArgoprojV1alpha1().WorkflowTaskSets returns an API error (conflict, RBAC denial, resource missing, server unavailable).

Common situations: Controller RBAC lacking patch permission on workflowtasksets; old cluster where the WorkflowTaskSet CRD isn't installed/upgraded; API server timeouts or excessive conflicts under load.

Related errors


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