elsa-workflows/elsa-core · error · AggregateException

One or more workflow commit notifications failed.

Error message

One or more workflow commit notifications failed.

What it means

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.

Solutions

  1. Inspect the AggregateException.InnerExceptions to identify which handlers failed and fix the root exception in the handler.
  2. Make commit-notification handlers resilient: catch and log their own errors unless they must abort the commit.
  3. Add retry/backoff for transient failures in handlers that must succeed.
  4. Catch AggregateException around FlushAsync and decide whether the failure is acceptable (log) or must be compensated.

Example fix

// before
await commitBuffer.FlushAsync(cancellationToken); // AggregateException bubbles up

// after
try
{
    await commitBuffer.FlushAsync(cancellationToken);
}
catch (AggregateException ex)
{
    foreach (var inner in ex.InnerExceptions)
        logger.LogError(inner, "Workflow commit notification failed.");
}
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    await commitBuffer.FlushAsync(ct);
}
catch (AggregateException ex)
{
    foreach (var inner in ex.InnerExceptions)
        logger.LogError(inner, "Commit notification handler failed.");
}

Prevention

When it happens

Trigger: Flushing the commit notification buffer (via FlushAsync at workflow commit/scope end) when one or more registered notification handlers threw during dispatch.

Common situations: 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.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13). Data as JSON: /api/errors/a34f8bd1a93615a6. Report an issue: GitHub.

Appendix: source

Thrown at src/modules/Elsa.Workflows.Runtime/Services/WorkflowCommitNotificationBuffer.cs:69

            foreach (var entry in _entries)
            {
                try
                {
                    await owner._mediator.SendAsync(entry.Notification, entry.Strategy, cancellationToken);
                }
                catch (Exception ex) when (ex is not OperationCanceledException and not OutOfMemoryException and not StackOverflowException)
                {
                    owner._logger.LogError(ex, "Failed to publish buffered workflow commit notification {NotificationType}", entry.Notification.GetType().FullName);
                    exceptions ??= [];
                    exceptions.Add(ex);
                }
            }

            _entries.Clear();

            if (exceptions is { Count: > 0 })
                throw new AggregateException("One or more workflow commit notifications failed.", exceptions);
        }

        public void Dispose()
        {
            if (_disposed)
                return;

            _disposed = true;
            if (ReferenceEquals(owner._currentScope.Value, this))
                owner._currentScope.Value = parent;
        }

        private void ThrowIfDisposed()
        {
            if (_disposed)
                throw new ObjectDisposedException(nameof(IWorkflowCommitNotificationScope));
        }
    }

View on GitHub (pinned to fe9217bdfa)