---
schema_version: "1"
id: e14b96c509594c56f867354c1af468d2ef77a6e166b59e2e1d6fa72ec7813f28
title: Apex Unexpected Exception Event Type
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/object_reference/sforce_api_objects_eventlogfile_apexunexpectedexception.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_eventlogfile_apexunexpectedexception.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 9835128ebfbc37eeb8f08acb063daff08b597a73f3e15c9ff0f2da82966fdf57
description: The Apex Unexpected Exception event type captures information about unexpected exceptions in Apex code execution. This event type is available in the EventLogFile object in API version 45.0 and later. Unexpected exception information is not captured in the EventLogFile object with @IsTest and anonymous Apex.
---
# Apex Unexpected Exception Event Type

The Apex Unexpected Exception event type captures information about unexpected exceptions in Apex code execution. This event type is available in the EventLogFile object in API version 45.0 and later. Unexpected exception information is not captured in the EventLogFile object with @IsTest and anonymous Apex.

For details about event monitoring, see the [Trailhead Event Monitoring module](https://trailhead.salesforce.com/en/modules/event_monitoring/units/event_monitoring_intro "HTML (New Window)") or [REST API Developer’s Guide](https://developer.salesforce.com/docs/atlas.en-us.264.0.api_rest.meta/api_rest/using_resources_event_log_files.htm "HTML (New Window)").

## Fields

| Field | Details |
| --- | --- |
| EVENT\_TYPE | 
Type

String

Description

The type of event. The value is always ApexUnexpectedException.



 |
| EXCEPTION\_CATEGORY | 

Type

String

Description

The category of the unexpected Apex exception. Provides a breakdown of unhandled exceptions based on the type. For example, the LimitException exception type is split into subcategories that indicate if you exceeded a limit, such as the total heap size or CPU time.

Possible values:

- Subcategories of LimitException that indicate the Apex limit you’ve exceeded. Examples:
    
    - LimitException: CpuTime: Maximum CPU time on the Salesforce servers.
    - LimitException: HeapSize: Total heap size.
    - LimitException: Queries: Total number of SOQL queries issued.
    - LimitException: QueryRows: Total number of records retrieved by SOQL queries.
    - LimitException: DmlStatements: Total number of DML statements issued.
    - LimitException: Callouts: Total number of callouts (HTTP requests or web services calls) in a transaction.
    
    See [Execution Governors and Limits](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_gov_limits.htm) for other limits.
- CustomException: Unhandled [custom exception](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexcode.meta/apexcode/apex_exception_custom.htm).
- An Apex exception that isn’t limit-related; see [Exception Class and Built-In Exceptions](https://developer.salesforce.com/docs/atlas.en-us.264.0.apexref.meta/apexref/apex_classes_exception_methods.htm)

This field is available in API version 57.0 and later.

Example

LimitException: CpuTime



 |
| EXCEPTION\_MESSAGE | 

Type

Text

Description

The exception’s message.

Example

Divide by 0



 |
| EXCEPTION\_TYPE | 

Type

String

Description

The class type of the unexpected exception.

Example

System.MathException



 |
| ORGANIZATION\_ID | 

Type

Id

Description

The 15-character ID of the org.

For example: 00D000000000123.



 |
| REQUEST\_ID | 

Type

String

Description

The unique ID of a single transaction. A transaction can contain one or more events. Each event in a given transaction has the same REQUEST\_ID.

For example: 3nWgxWbDKWWDIk0FKfF5DV.



 |
| STACK\_TRACE | 

Type

Text

Description

The stack trace for the exception.

![Note](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/images/icon_note.png)

#### Note

If the exception is thrown from a managed package, STACK\_TRACE is omitted.

Example

Class.OpportunityUtility.insert: line 22, column 1
AnonymousBlock: line 1, column 1







 |
| TIMESTAMP | 

Type

String

Description

The access time of Salesforce services in GMT.

For example: 2024-08-08T06:08:02.755+0000.



 |
| TIMESTAMP\_DERIVED | 

Type

DateTime

Description

The access time of Salesforce services in ISO8601-compatible format (YYYY-MM-DDTHH:MM:SS.sssZ).

For example: 2015-07-27T11:32:59.555Z. Timezone is GMT.



 |
| USER\_ID | 

Type

Id

Description

The 15-character ID of the user who’s using Salesforce services through the UI or the API. For example: 00530000009M943.



 |
| USER\_ID\_DERIVED | 

Type

Id

Description

The 18-character case-insensitive ID of the user who’s using Salesforce services through the UI or the API.

For example: 00590000000I1SNIA0.



 |

#### See Also

- [EventLogFile Supported Event Types](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_eventlogfile_supportedeventtypes.htm "The EventType field in the EventLogFile object supports these events. Some common fields, such as CPU_TIME and RUN_TIME, can have null or zero values depending on how the events are generated for a given feature. Sometimes, three quotation marks appear around event data containing special characters in the CSV file. The third quotation mark is necessary for tools and applications to parse the field data at the correct field value boundary.")
- [EventLogFile](https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/sforce_api_objects_eventlogfile.htm "Represents event log files generated by Event Monitoring. Use event log file data to analyze usage trends and user behavior in your Salesforce org. This object is available in API version 32.0 and later. The Interval and Sequence fields are available only in API version 37.0 and later.")