Skip to main content

Have you come across the following Drupal error message:

Mismatched entity and/or field definitions. The following changes were detected in the entity type and field definitions.

Run a database update status check

drush updatedb:status --entity-updates

Response

 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 
  Module             Update ID                          Type            Description                                                           
 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 
  node entity type                                      entity-update   The node.field_objectives field needs to be updated.                  
  node               glossary_view_published            post-update     Add a published filter to the glossary View.                          
  views              remove_sorting_global_text_field   post-update     Clear caches due to removal of sorting for global custom text field.  
 ------------------ ---------------------------------- --------------- ---------------------------------------------------------------------- 

In my situation I had a missing module.  The irony here, was the offending module was migrate_tools which in Drupal 9 is no longer required.  As the migrate tools have become apart of core.  Once I added the file, I was able to update a correct the error.

This can be tested again by running the same status command again.

drush updatedb:status --entity-updates

The results show no errors.  Now it is time to run the update db command.

drush updb

Response

 -------- ------------------ ------------- -------------------------------- 
  Module   Update ID          Type          Description                     
 -------- ------------------ ------------- -------------------------------- 
  node     glossary_view_pu   post-update   Add a published filter to the   
           blished                          glossary View.                  
  views    remove_sorting_g   post-update   Clear caches due to removal of  
           lobal_text_field                 sorting for global custom text  
                                            field.                          
 -------- ------------------ ------------- -------------------------------- 

 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

>  [notice] Update started: node_post_update_glossary_view_published
>  [notice] Update completed: node_post_update_glossary_view_published
>  [notice] Update started: views_post_update_remove_sorting_global_text_field
>  [notice] Update completed: views_post_update_remove_sorting_global_text_field
 [success] Finished performing updates.

 

Not working for you?

For some sites, the above commands solved the issue.  However, on another site... not working.

 ------------------ ----------- --------------- -------------------------------
  Module             Update ID   Type            Description
 ------------------ ----------- --------------- -------------------------------
  node entity type               entity-update   The node.field_topics field
                                                 needs to be updated.
  user entity type               entity-update   The
                                                 user.field_pending_expire_sen
                                                 t field needs to be updated.
 ------------------ ----------- --------------- -------------------------------

In this instance, I tried a different approach and focus on applying the pending updates.  Use the command:

drush entity:updates

Or alias commands

drush entup
drush entity-updates

Response from using one of the above commands:

The following updates are pending:

node entity type :
The node.field_topics field needs to be updated.
user entity type :
The user.field_pending_expire_sent field needs to be updated.

Do you wish to run all pending updates? (yes/no) [yes]:
 >

Press return to continue

Successful response

 [success] Finished performing updates.

 

Related articles

Andrew Fletcher04 Apr 2025
Managing .gitignore changes
When working with Git, the .gitignore file plays a critical role in controlling which files and folders are tracked by version control. Yet, many developers are unsure when changes to .gitignore take effect and how to manage files that are already being tracked. This uncertainty can lead to...
Andrew Fletcher26 Mar 2025
How to fix the ‘Undefined function t’ error in Drupal 10 or 11 code
Upgrading to Drupal 10.4+ you might have noticed a warning in their code editor stating “Undefined function ‘t’”. While Drupal’s `t()` function remains valid in procedural code, some language analysis tools — such as Intelephense — do not automatically recognise Drupal’s global functions. This...
Andrew Fletcher17 Mar 2025
Upgrading to PHP 8.4 challenges with Drupal contrib modules
The upgrade from PHP 8.3.14 to PHP 8.4.4 presents challenges for Drupal 10.4 websites, particularly when dealing with contributed modules. While Drupal core operates seamlessly, various contrib modules have not yet been updated to accommodate changes introduced in PHP 8.4.x. This has resulted in...