{"record":{"id":"03c922874925ea4e","repo":"argoproj/argo-workflows","slug":"failed-to-dispatch-event-v","errorCode":null,"errorMessage":"failed to dispatch event: %v","messagePattern":"failed to dispatch event: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/event/dispatch/operation.go","lineNumber":83,"sourceCode":"\tlogger.Debug(ctx, \"Executing event dispatch\")\n\n\tdata, _ := json.MarshalIndent(o.env, \"\", \"  \")\n\tlogger.Debug(ctx, string(data))\n\n\tvar errs []error\n\tfor _, event := range o.events {\n\t\terr := waitutil.Backoff(retry.DefaultRetry, func() (bool, error) {\n\t\t\t_, err := o.dispatch(ctx, event)\n\t\t\treturn !errorsutil.IsTransientErr(ctx, err), err\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.WithError(err).WithFields(logging.Fields{\"namespace\": event.Namespace, \"event\": event.Name}).Error(ctx, \"failed to dispatch from event\")\n\t\t\to.eventRecorder.Event(&event, corev1.EventTypeWarning, \"WorkflowEventBindingError\", \"failed to dispatch event: \"+err.Error())\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"failed to dispatch event: %v\", errs)\n\t}\n\treturn nil\n}\n\nfunc (o *Operation) dispatch(ctx context.Context, wfeb wfv1.WorkflowEventBinding) (*wfv1.Workflow, error) {\n\tlogger := logging.RequireLoggerFromContext(ctx)\n\n\tselector := wfeb.Spec.Event.Selector\n\tmatched, err := argoexpr.EvalBool(selector, o.env)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to evaluate workflow template expression: %w\", err)\n\t}\n\tlogger.WithFields(logging.Fields{\"namespace\": wfeb.Namespace, \"event\": wfeb.Name, \"selector\": selector, \"matched\": matched}).Debug(ctx, \"Selector evaluation\")\n\tsubmit := wfeb.Spec.Submit\n\tif matched && submit != nil {\n\t\t//nolint: contextcheck\n\t\tclient := auth.GetWfClient(o.ctx)\n\t\tref := wfeb.Spec.Submit.WorkflowTemplateRef","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/server/event/dispatch/operation.go#L65-L101","documentation":"Operation.Dispatch iterates all WorkflowEventBindings matching the namespace/discriminator and collects per-binding errors; if any binding failed, it aggregates and returns \"failed to dispatch event: [errs]\". Each failing binding also emits a Kubernetes Warning event 'WorkflowEventBindingError'. The message body is a Go slice of errors, so multiple failures appear as a printed list.","triggerScenarios":"One or more WorkflowEventBindings in the namespace fail during dispatch: selector evaluation error (309), workflow submit failure (RBAC, invalid generated workflow, missing template), or a timeout — any binding error causes this aggregate.","commonSituations":"A selector referencing payload fields that don't exist on that event's payload; submit referencing a WorkflowTemplate that was deleted; RBAC changes breaking the server's ability to create workflows in the namespace; malformed submit.workflowTemplateRef.","solutions":["Read the bracketed inner errors in the message and the 'WorkflowEventBindingError' events: `kubectl get events -n <ns> | grep WorkflowEventBindingError`.","Fix each binding's selector (`spec.event.selector`) to match the actual payload shape, guarding optional fields, e.g. `payload.foo != nil && payload.foo == \"bar\"`.","Verify the referenced WorkflowTemplate/ClusterWorkflowTemplate exists and validates (`argo lint`).","Check argo-server RBAC can create Workflows in the namespace.","Re-drive the event with `argo events test` after fixing to confirm."],"exampleFix":"# before: selector breaks when field absent\nselector: payload.head_commit.id == \"abc\"\n# after\nselector: payload.head_commit != nil && payload.head_commit.id == \"abc\"","handlingStrategy":"try-catch","validationCode":"// check for failing bindings' events before re-driving\nevents, _ := clientset.CoreV1().Events(ns).Search(scheme.Scheme,\n\t&corev1.ObjectReference{Kind: \"WorkflowEventBinding\", Name: wfebName})\nfor _, e := range events {\n\tif e.Reason == \"WorkflowEventBindingError\" { /* fix cause before retry */ }\n}","typeGuard":null,"tryCatchPattern":"err := op.Dispatch()\nif err != nil {\n\t// message contains \"failed to dispatch event: [errs...]\"\n\t// read per-binding inner errors and Kubernetes warning events\n\treturn fmt.Errorf(\"event processing failed: %w\", err)\n}","preventionTips":["Guard selectors against nil payload fields","Ensure referenced WorkflowTemplates exist and lint clean","Verify argo-server RBAC for creating workflows in the namespace","Monitor WorkflowEventBindingError events and alert on them"],"tags":["events","eventbinding","dispatch","workflow-submit"],"backgroundTag":"event-dispatch-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}