Drupal 8: Mismatched entity and/or field definitions

Drupal 8: Mismatched entity and/or field definitions

Sat, 04/02/2016 - 21:52
Posted in:

You might noticed "Mismatched entity and/or field definitions" error in your status report page. This post will help you to find cause and solution for this issue.

When this issue arrives?

After enabling "pathauto" module or updating "Inline Entity Form module" I saw this problem in status report of Drupal 8. Something like this "The URL alias field needs to be uninstalled."

Mismatched entity or field definitions

Also, when I uninstalled and then reinstalled Drupal comment module this issue came again but message was different this time. Message was "The comment.comment_body field needs to be updated.

Comment body field error

What is this error?

This error comes because Drupal 8 doesn't auto-update fields and entities upon installation of new modules.

How to solve this issue?

There are two ways by which you can update entities.

  1. Drush command
  2. Manually executing code though index.php or using devel module.
  • If you have Drush, run following command in terminal -
drush entity-updates

A terminal window will display the same message and asks for an update permission. Continuing with yes(y) updates will get performed and the issue will be fixed.

Drush command terminal

  • If you don't have Drush for drupal 8, please add the following script before $response->send(); in index.php file(located in Drupal root folder) and reload the web page.
try {
catch (EntityStorageException $e) {

That's all. Now you can notice that the error message is disappeared in status report page since all entities are updated. Of course, you need to remove the above script from index.php once you fixed the error.

If you don't want to alter index.php you can use Devel module. On the "Execute PHP Code" page at http://example.com/devel/php paste above code and run it.

Hope it helps. It worked for me in both cases.

Check now : How to install drush for drupal 8 on shared hosting?



Submitted by lolhonk on Fri, 02/24/2017 - 23:27 Permalink

worked! Thank u very much. i used the variant via the index.php

Submitted by brokendrupal on Thu, 03/30/2017 - 18:14 Permalink

Doesn't work for me.

I get "The website encountered an unexpected error. Please try again later."

Drupal 8.2.7

Problem: Webform entity "Webform Submission" not installed

I think you should do like this -

1. Uninstall webform module.

2. Run entity update command.

3. The error will be gone and then reinstall webform module.

Submitted by Sarah Heinemann on Fri, 07/07/2017 - 22:54 Permalink

I'm a beginning to Drupal and was so happy to find this info - Thank you!! - but it didn't work for me. My status report error:

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Custom block
The Revision create time field needs to be updated.
The Revision user field needs to be updated.

Saving any page edits returns this page error:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'revision_created' in 'field list': [...SNIP...] in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 777 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Tried your fix via Devel and editing index.php but both return the same result. On any page load the site returns this now:
Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. SQLSTATE[42S22]: Column not found: 1054 Unknown column 'revision_created' in 'where clause': SELECT 1 AS expression FROM {block_content_field_data} t WHERE revision_created IS NOT NULL LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1485 of core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

Any ideas? Help would definitely be appreciated, I'm at a standstill with this.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The content of this field is kept private and will not be shown publicly.