Drupal 8 "Mismatched entity and/or field definitions"

Published February 23, 2016

Updating modules in Drupal 8 is similar to updating modules in Drupal 7 - the drush pm-update (drush up) command still works, but there's a new "gotcha" that you need to look out for when updating modules that work with entities. 

Sometimes, after updating modules that interact with entities, you'll see a "Entity/field definitions: Mismatched entity and/or field definitions" error on your site's status report (admin/reports/status). 

"Mismatched entity and/or field definitions" error

In the screenshot above, this error was generated by updating the Inline Entity Form module from its alpha4 version to the most recent -dev version (the site also uses the Scheduled Updates module). As long as a mismatch is present, the fields listed in the error will lead to unpredictable results.

Neither rebuilding caches nor running cron will fix this issue ("drush up" doesn't automatically run this command either) - for these types of errors, the drush entity-updates command is what you're looking for.

Once this command is run, your status report will look something like this:

Clean status report

This is just one more reason why checking your site's status report page after updating modules is always a good idea. 

 

Comments

I've indeed run into this problem with pathauto in Drupal 8. However, I'm developing in a Windows environment. Is there a way to resolve these mismatch situations without the use of drush?

Submitted by zoondev (not verified) on Thu, 03/03/2016 - 11:38

If you don't have Drush for drupal 8, please add the following script written on this page before $response->send(); in index.php file.

Submitted by Rahul (not verified) on Thu, 08/11/2016 - 03:07

In reply to by zoondev (not verified)

Hi Mike, this is great, and I have no problem using drush, but it seems to me as a matter of principle that there should be a file like update.php to run to fix these issues. I have been Googling around all morning and can't seem to find any info where this is being contemplated.

Submitted by Robert Kopacz (not verified) on Sun, 03/06/2016 - 08:08

Is there any way of fixing this without using Drush? I added an update script to Metatag to fix it after the module added a config entity, but that lead to other problems (https://www.drupal.org/node/2671194).

Submitted by Damien McKenna (not verified) on Thu, 03/10/2016 - 10:31

It worked for me :)

Submitted by Farliec (not verified) on Mon, 04/04/2016 - 18:18

Thank you, easy, quick and deadly right!

Submitted by d70rr3s (not verified) on Wed, 03/22/2017 - 05:38

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!

Name
CAPTCHA