The entity type [entity name] does not have an “revision_created” entity revision metadata key

This error occurs sometimes when creating/uninstalling custom entities in drupal 8 or 9. 

Solution

The error occurs when you try to create an entity that extends:

EditorialContentEntityType

When using one of these, you must user revisions. Thus then you need to add:

 * revision_metadata_keys = {
 *     "revision_user" = "revision_user",
 *     "revision_created" = "revision_created",
 *     "revision_log_message" = "revision_log"
 *   },

To your entity annotations. If you don't want to use revisions, you should extend

ContentEntityBase

But you should know that you can't use things like workflows, because these require revisions.

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!