{"record":{"id":"dc6c16f84f1da2c1","repo":"argoproj/argo-workflows","slug":"failed-patching-taskset-w","errorCode":null,"errorMessage":"failed patching taskset: %w","messagePattern":"failed patching taskset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/controller/taskset.go","lineNumber":28,"sourceCode":"\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\t\"k8s.io/apimachinery/pkg/types\"\n\n\targoerrors \"github.com/argoproj/argo-workflows/v4/errors\"\n\t\"github.com/argoproj/argo-workflows/v4/pkg/apis/workflow\"\n\twfv1 \"github.com/argoproj/argo-workflows/v4/pkg/apis/workflow/v1alpha1\"\n\t\"github.com/argoproj/argo-workflows/v4/util/logging\"\n\t\"github.com/argoproj/argo-workflows/v4/workflow/common\"\n\tcontrollercache \"github.com/argoproj/argo-workflows/v4/workflow/controller/cache\"\n)\n\nfunc (woc *wfOperationCtx) mergePatchTaskSet(ctx context.Context, patch any, subresources ...string) error {\n\tpatchByte, err := json.Marshal(patch)\n\tif err != nil {\n\t\treturn argoerrors.InternalWrapError(err)\n\t}\n\t_, err = woc.controller.wfclientset.ArgoprojV1alpha1().WorkflowTaskSets(woc.wf.Namespace).Patch(ctx, woc.wf.Name, types.MergePatchType, patchByte, metav1.PatchOptions{}, subresources...)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed patching taskset: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc (woc *wfOperationCtx) getDeleteTaskAndNodePatch(nodes wfv1.Nodes) (tasksPatch map[string]any, nodesPatch map[string]any) {\n\tdeletedNode := make(map[string]any)\n\tfor _, node := range nodes {\n\t\tif node.IsTaskSetNode() && node.Fulfilled() {\n\t\t\tdeletedNode[node.ID] = nil\n\t\t}\n\t}\n\n\t// Delete the completed Tasks and nodes status\n\ttasksPatch = map[string]any{\n\t\t\"spec\": map[string]any{\n\t\t\t\"tasks\": deletedNode,\n\t\t},\n\t}","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/controller/taskset.go#L10-L46","documentation":"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.","triggerScenarios":"createTaskSet or removeCompletedTaskSetStatus calls mergePatchTaskSet and the Patch call on ArgoprojV1alpha1().WorkflowTaskSets returns an API error (conflict, RBAC denial, resource missing, server unavailable).","commonSituations":"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.","solutions":["Verify the WorkflowTaskSet CRD is installed and up to date (match controller version)","Grant the controller RBAC patch rights on workflowtasksets.argoproj.io","Check API server health/events; the controller retries automatically, so inspect controller logs if it keeps failing"],"exampleFix":"// before (RBAC)\nrules:\n  - apiGroups: [argoproj.io]\n    resources: [workflowtasksets]\n    verbs: [get, list, watch]\n// after\nrules:\n  - apiGroups: [argoproj.io]\n    resources: [workflowtasksets]\n    verbs: [get, list, watch, create, update, patch, delete]","handlingStrategy":"retry","validationCode":"kubectl auth can-i patch workflowtasksets.argoproj.io -n ns --as=system:serviceaccount:argo:workflow-controller","typeGuard":null,"tryCatchPattern":"if strings.Contains(err.Error(), \"failed patching taskset\") {\n    // transient API failure: rely on controller retry with backoff\n}","preventionTips":["Keep WorkflowTaskSet CRD in sync with controller version","Grant full taskset RBAC to the controller","Monitor API server errors/conflicts in controller logs"],"tags":["kubernetes","argo-workflows","taskset","api-server"],"backgroundTag":"k8s-patch-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}