{"record":{"id":"a34f8bd1a93615a6","repo":"elsa-workflows/elsa-core","slug":"one-or-more-workflow-commit-notifications-failed","errorCode":null,"errorMessage":"One or more workflow commit notifications failed.","messagePattern":"One or more workflow commit notifications failed\\.","errorType":"exception","errorClass":"AggregateException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Workflows.Runtime/Services/WorkflowCommitNotificationBuffer.cs","lineNumber":69,"sourceCode":"\n            foreach (var entry in _entries)\n            {\n                try\n                {\n                    await owner._mediator.SendAsync(entry.Notification, entry.Strategy, cancellationToken);\n                }\n                catch (Exception ex) when (ex is not OperationCanceledException and not OutOfMemoryException and not StackOverflowException)\n                {\n                    owner._logger.LogError(ex, \"Failed to publish buffered workflow commit notification {NotificationType}\", entry.Notification.GetType().FullName);\n                    exceptions ??= [];\n                    exceptions.Add(ex);\n                }\n            }\n\n            _entries.Clear();\n\n            if (exceptions is { Count: > 0 })\n                throw new AggregateException(\"One or more workflow commit notifications failed.\", exceptions);\n        }\n\n        public void Dispose()\n        {\n            if (_disposed)\n                return;\n\n            _disposed = true;\n            if (ReferenceEquals(owner._currentScope.Value, this))\n                owner._currentScope.Value = parent;\n        }\n\n        private void ThrowIfDisposed()\n        {\n            if (_disposed)\n                throw new ObjectDisposedException(nameof(IWorkflowCommitNotificationScope));\n        }\n    }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Workflows.Runtime/Services/WorkflowCommitNotificationBuffer.cs#L51-L87","documentation":"WorkflowCommitNotificationBuffer.FlushEntriesAsync dispatches buffered commit notifications and collects per-item failures. If any notification handler failed, it throws AggregateException('One or more workflow commit notifications failed.') after clearing the buffer, so callers know that not all commit notifications were delivered even though the workflow commit itself proceeded.","triggerScenarios":"Flushing the commit notification buffer (via FlushAsync at workflow commit/scope end) when one or more registered notification handlers threw during dispatch.","commonSituations":"A custom INotificationHandler for commit notifications throwing (DB hiccup, unhandled null); event publishing strategy failing for one subscriber; transient broker/store errors during commit notifications.","solutions":["Inspect the AggregateException.InnerExceptions to identify which handlers failed and fix the root exception in the handler.","Make commit-notification handlers resilient: catch and log their own errors unless they must abort the commit.","Add retry/backoff for transient failures in handlers that must succeed.","Catch AggregateException around FlushAsync and decide whether the failure is acceptable (log) or must be compensated."],"exampleFix":"// before\nawait commitBuffer.FlushAsync(cancellationToken); // AggregateException bubbles up\n\n// after\ntry\n{\n    await commitBuffer.FlushAsync(cancellationToken);\n}\ncatch (AggregateException ex)\n{\n    foreach (var inner in ex.InnerExceptions)\n        logger.LogError(inner, \"Workflow commit notification failed.\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try\n{\n    await commitBuffer.FlushAsync(ct);\n}\ncatch (AggregateException ex)\n{\n    foreach (var inner in ex.InnerExceptions)\n        logger.LogError(inner, \"Commit notification handler failed.\");\n}","preventionTips":["Make notification handlers defensive: log, don't throw, unless aborting is required","Add retry/backoff for transient handler failures","Inspect AggregateException.InnerExceptions to find the failing handler"],"tags":["notifications","commit","runtime","aggregate-exception"],"backgroundTag":"http-error-response","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}