CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: meaning and how to fix it

Apex runtime Checked against the official docs on Source: SOAP API Developer Guide: Core Data Types, StatusCode

Quick answer

CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY: An error occurred in a trigger, flow or process that ran while saving. This is a wrapper: the real error is the exception named after "caused by". The status code can also mean a missing permission to create, update or activate the record. Start with: Read the text after "caused by:" and find that exception in this list.

Typical message: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, MyTrigger: execution of BeforeInsert caused by: System.NullPointerException: Attempt to de-reference a null object

Cause

An error occurred in a trigger, flow or process that ran while saving. This is a wrapper: the real error is the exception named after "caused by". The status code can also mean a missing permission to create, update or activate the record.

How to fix CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY

  1. Read the text after "caused by:" and find that exception in this list.
  2. The trigger name and line number in the message show where it failed.
  3. Reproduce with the same data and open the debug log to see the execution path.

Have a different message? Paste it into the error decoder, which matches it against 45 common Salesforce errors in your browser.

Frequently asked questions

What does CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY mean in Salesforce?

An error occurred in a trigger, flow or process that ran while saving. This is a wrapper: the real error is the exception named after "caused by". The status code can also mean a missing permission to create, update or activate the record.

How do I fix CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY?

1. Read the text after "caused by:" and find that exception in this list. 2. The trigger name and line number in the message show where it failed. 3. Reproduce with the same data and open the debug log to see the execution path.

More Apex runtime errors

SFDX Talk is unofficial documentation. It is not affiliated with, endorsed by, or sponsored by Salesforce, Inc. Message text varies slightly by release and context, so confirm against the official page before relying on it.