How-To

Umbraco Commerce abandoned cart error: empty array 'to'

The error means the abandoned cart notifier built an email with no recipients. A cart holds a malformed customer address such as jane@example, the address is dropped, and the send throws. Fix it by validating the email before the notification is created, then clean up the carts already affected.

Sohail HussainSohail Hussain7 min read

Short answer

  • The error means the abandoned cart email was built with no recipients, because the customer address on the cart (for example jane@example) was invalid and got dropped.
  • Validate the email before the abandoned cart notification is created, and check that your Umbraco Commerce version includes the upstream fix, which is closed.
  • Then correct or clear the carts that already hold bad addresses, or they will keep logging errors.

Your Umbraco log shows this line for an abandoned cart email, once per cart:

Value cannot be an empty array. (Parameter 'to')

Nothing was sent. The message had no one to go to, so the send threw before any mail server was contacted.

Why it happens

This is a .NET argument exception raised inside your application, not an SMTP error. There is no bounce code to look up at Gmail or Microsoft, because no connection to your mail provider was made.

  • Value cannot be an empty array means a collection with no items was passed.
  • (Parameter 'to') names the argument: the recipient list of the outgoing message.

The sequence, as described in the upstream issue on Umbraco Commerce's issue tracker (issue 911):

  1. A cart holds a malformed customer email, such as jane@example.
  2. The abandoned cart notifier picks up the cart.
  3. The invalid address is dropped when the message is assembled, so the recipient list is empty.
  4. The send throws, and an error is logged for that cart.

You get one log entry per affected cart, which is why a handful of bad carts can look like a flood. The upstream issue is closed. I have not verified which release contains the change, so check the issue thread and release notes rather than relying on a version number from me.

CauseSymptomFix
Malformed address on the cartOne error per cart, same cart repeats each notifier runValidate before notification; clean the cart
Version without the upstream fixError with addresses that look invalidUpgrade Umbraco Commerce via NuGet
Custom handler or template clears the To listError even though the stored email is validFix your own code to skip empty lists

Confirm it is this cause

  1. Take the timestamp and cart or order identifier from the log entry and open that cart in the Umbraco Commerce section of the backoffice.
  2. Read the customer email stored on the cart. Look for a missing top-level domain (jane@example), a missing @, stray spaces, a comma instead of a dot, or an empty value.
  3. Compare the number of errors with the number of carts that have bad addresses. If they match, you have the cause.

If the stored email is valid and you still get the exception, something in your own notification handler or template is probably clearing the recipient list. Look for code that fills the To list from a field that can be empty.

Fix 1: upgrade to a release that contains the upstream fix

  1. Note your current Umbraco Commerce version from your project's package list.
  2. Open the upstream issue and its linked release notes, and find the version that addresses it.
  3. If you are behind, upgrade the Umbraco Commerce packages through NuGet.
  4. Test on a staging copy with a cart that has jane@example, then deploy.

Back up first

Upgrade on a staging copy before production, and take a database backup. Commerce upgrades can include schema migrations.

Fix 2: validate the email before the notification is created

If you cannot upgrade yet, or want a guard of your own, stop invalid addresses where they enter the system. Two places are worth covering:

  • At checkout. Validate the email server-side when the customer enters it, and reject or flag an invalid value. Client-side checks alone are not enough.
  • Before the abandoned cart notification. Skip carts whose email fails validation instead of letting the notifier try to send to them.

A minimal server-side check in C#:

using System.Net.Mail;

static bool IsSendableEmail(string? value)
{
    if (string.IsNullOrWhiteSpace(value)) return false;
    if (!MailAddress.TryCreate(value.Trim(), out var address)) return false;

    // MailAddress accepts "jane@example"; require a dot in the host.
    return address.Host.Contains('.');
}

The host check matters because a single-label host is syntactically legal, so a parser alone lets jane@example through. Requiring a dot rejects it. This is a pragmatic filter, not a full validator, and it will reject a few legal but unusual addresses such as intranet hosts. For a store that mails the public, I'd accept that trade.

Where you apply the check depends on how your project hooks into the abandoned cart flow. Event and class names differ between Umbraco Commerce versions, so check the documentation for your version for the notification hook to wrap.

Fix 3: clean up carts that already have bad addresses

Validation going forward does not repair existing data. Carts that already carry a bad value keep logging errors on each notifier run until they expire or are removed.

  1. Identify the affected carts from your log entries.
  2. Correct the email where you can, or clear the abandoned cart state for those carts if your setup allows it.
  3. Watch the next notifier run and confirm the errors stop.

Do not just mute the log

You can raise the log level for the logger that emits this error in your Serilog or appsettings configuration, but keep it short-term. Hiding the message also hides carts that are not getting a reminder.

Checklist before you try again

  • The customer email on the failing cart is valid, with a dot in the domain.
  • Your Umbraco Commerce version includes the upstream fix, or your own validation runs first.
  • Your handler skips an empty To list and logs a warning with the cart ID instead of throwing.
  • You have a test case with jane@example in your abandoned cart tests.
  • The next notifier run produces no new errors.

If nothing works

If the error continues with valid addresses on a version that includes the fix, comment on the upstream issue in the Umbraco Commerce issue tracker, or contact Umbraco support if you have a support plan. Include the exact Umbraco Commerce version, the full stack trace, the log timestamp, and the stored customer email with the domain masked if it is private.

If mail starts failing after it leaves your server, with a numeric SMTP reply such as a 5.x.x code, that is a different problem; this one never gets that far.

Subject: Abandoned cart email throws "Value cannot be an empty array. (Parameter 'to')"

Umbraco version: {version}
Umbraco Commerce version: {version}
Log timestamp: {timestamp}
Cart/order ID: {id}
Customer email on the cart: {masked, e.g. jane@e*****}

The abandoned cart notifier throws the error above, once per cart. The
stored email is [invalid / valid]. I have upgraded to the version named in
the upstream issue: [yes/no]. Full stack trace attached.

Common questions

Is this an SMTP or mail server problem?

No. The exception is raised in your application before any connection to a mail server, so there is no bounce or reply code to look up.

Why does one bad cart create so many log lines?

The notifier retries on each run, and each failing cart logs its own error. One bad address can repeat until the cart expires or you fix it.

Will the customer still get a reminder after I fix the address?

Only if the corrected address is valid and the cart is still eligible when the notifier next runs. Carts you skip or clear will not send.

Does a valid-looking address like jane@example.c pass my check?

It passes the dot check, so it would be sent to and may bounce later. Treat the check as a filter for obviously broken values, and handle real bounces through your mail provider.

strategyumbraco-commerceerror-codes
Share this article
Sohail Hussain

Sohail Hussain

Founder & CEO at Mailneo

Building Mailneo — AI-powered email marketing for growing businesses.

Ready to supercharge your email marketing?

Start sending smarter emails with AI-powered campaigns. No credit card required.

Get Started Free