The Background

According to the help docs

When unhandled Apex exceptions occur, emails are sent that include the Apex stack trace and the customer’s org and user ID.

However I frequently encounter times when these emails are not sent (i.e. I generated it, or a user sends me a screenshot of something that should have generated an error).

According to the help docs

If duplicate exceptions occur in Apex code that runs synchronously, subsequent exception emails are suppressed and only the first email is sent.

So at least in the case of duplicates (whatever that's defined) as the emails aren't sent, but the docs don't mention anything else and this seems to happen far more often than I like given how much I'm counting on this mechanism to allow me to identify major code issues.

The Question

In what other cases would the unhandled exception email not get sent to the emails listed in the Apex Exception Email section of setup? And in the case of duplicates what counts as a duplicate? Given the importance of exception handling it would be incredibly helpful to the community to understand when you can't count on apex exception emails to reliably alert you to code issues. Authoritative sources greatly appreciated.

NB Please assume things are configured correctly, i.e. email deliverablity is on, you've added your email to the apex exception email list, and you get apex exception emails, but not always

2 Answers 2


Found this interesting statement in the idea Need a reliable developer script exception alert mechanism:

Salesforce R&D has acknowledged the issue but states it is a feature frozen area therefore, there is no known issue is being worked on. R&D is planning to replace this feature with full-featured exception handling/notification/management system.

Unfortunately there isn't a case number that could provide further reference around that statement.

There is also the known issue Single error email would be sent out for all identical unhandled Apex exception:

"The developer specified in the LastModifiedBy field receives the error via email with the Apex stack trace and the customer’s organization and user ID. No other customer data is returned with the report. Note that for Apex code that runs synchronously, some error emails may get suppressed for duplicate exception errors."

However, the Salesforce framework may suppress additional emails not mentioned here. Only one error email is sent out for all identical unhandled Apex exceptions

That certainly suggests that there are scenarios where "identical" exceptions will be suppressed. Unfortunately, that just moves the question down to defining what makes two exceptions identical.

September 2020 update:

Another Known Issue has been acknowledged - Missing Unhandled Apex Exceptions Emails.

Sometimes customers will not receive all of the expected Apex Exception Emails when a runtime unhandled exception occurs in their code.
There is an instance-wide limit of a few hundred exception emails per hour. Because of this, the exception email quota can be used by few orgs on the instance, depriving other orgs from receiving all of the exception emails occurring in the same hour.

So, even with the an entirely new and unseen exception, you might not get the error email if other tenant orgs are throwing lots of errors.

I've asked around a few sources. For a number of reasons you are unlikely to get a better answer around exactly how it works (or doesn't in some cases). Unfortunately that includes what constitutes an exception that will get suppressed.

Voting for the idea above is currently the best course of action for improving the current exception reporting mechanism long term.



One of the things to check is if the Send Apex Warning Emails checkbox is checked on the respective User record for those specific Users within your Salesforce instance.

Also as per this Knowledgebase Article,

The Send Apex Warning Emails settings on the User record only controls whether or not you get Apex warning emails every time that an Apex surpasses more than 50% of allocated governor limit. This is available in DE, EE and UE Editions only.

Other thing to note as per this Knowledgebase Article is

Unhandled exception emails are sent by default to the developer specified in the LastModifiedBy field on the failing class or trigger. In addition, you can have emails sent to users of your Salesforce org and to arbitrary email addresses.

To set up these email notifications within your Salesforce instance, from Setup, enter Apex Exception Email in the Quick Find box, then select Apex Exception Email. You can either add existing Salesforce Users or you can include external email addresses who can be notified in case of exception emails. You can also configure Apex exception emails using the Tooling API object ApexEmailNotification.

  • 4
    high quality answer, but looking for cases where these aren't sent if they are set up correctly, meaning apex exception email. what i'm looking at is the documentation gives you the expectation once you set things up you should always get an exception email, but i frequently and irrefutably find that doesn't always happen (i.e. i create a method that throws an exception, call it, it throws it, but i don't get an email) Commented May 31, 2018 at 3:49
  • 1
    Are you open to a custom error logging solution?
    – Jigar Shah
    Commented May 31, 2018 at 6:05
  • 1
    Already did that :), reason I asked the question is this is supposed to work all the time, but seems to have undocumented edge cases. I think the community would benefit from knowing what those are and be broad enough to have experience to know them. Updated the questions to be clearer about the purpose. Commented Jun 1, 2018 at 0:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .