Mismatched entity and/or field definitions

Created on 1 September 2025, about 1 month ago

Problem/Motivation

After updating to 8.x-1.12 and running update.php (which showed one redirect database update needed running), The Status report page is showing an error:

Errors found: Entity/field definitions

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

Redirect

  • The Redirect entity type needs to be updated.

The redirects on my site appear to be working. It's just this prominent error message that is the problem.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.12

Component

Code

Created by

🇹🇼Taiwan johnalbin Taipei, Taiwan

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @johnalbin
  • 🇹🇼Taiwan johnalbin Taipei, Taiwan
  • Hi,

    Same here, with a different message though (in French):

    Errors found: Entity/field definitions

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

    Redirect

    Le champ Activé nécessite d'être installé (The Enabled field requires installation).

    Any clue on where to search this field or how to fix the error?

    Thanks!

  • 🇷🇴Romania amateescu

    Have you previously patched the module with a change that included a redirect_update_8110() function? See #3543872-2: Latest version of Redirect module failed to run updates. for a longer explanation.

  • Yes, as a matter of fact, the module was previously patched with this patch to resolve an issue of case sensibility 📌 Case sensitivity Active . I removed the patch before upgrading though.

    So, I tried the solution from #4 and yes, it does work on my local environment, but not on production as I don't know how to pass the php-eval command as it doesn't show in github (and I'm no developer).
    Is there a way for you to create a patch for this? It would be most helful!

    Thanks!

  • 🇺🇸United States rraney

    This happened to me and some people noticed redirects not working anymore. I investigated and found they had an "Enable" checkbox which was not selected. Is the "Enable" box new? That's a separate issue, but related to the update. Opening another issue if it's not already reported.

  • 🇹🇼Taiwan johnalbin Taipei, Taiwan

    Have you previously patched the module with a change that included a redirect_update_8110() function?

    Thanks for replying so quickly!

    As I stated in the original post, I ran update.php and a redirect database update was run successfully.

    When I go to /admin/config/search/redirect all of my existing redirect rules show an "enabled" checkbox which is checked. And I tested some of my redirects and they worked fine.

    But the "mismatched" error on the status page appeared after doing the 1.12 update.

    To help debug this, here's more context:

    • Using PHP 8.4.11
    • Using MariaDB 10.6.22-MariaDB-cll-lve according to the Status Page
    • I've attached the redirect db table structure from my server's database
    • I've attached a copy of the redirect.settings.yml from my /config/sync/ folder

    I'll be happy to send anything else you might find useful.

  • 🇷🇴Romania amateescu

    @johnalbin, in your case, there's a difference between the live (in-code) and last installed entity type definition. In order to see the difference, you'll need to compare the objects returned by \Drupal::entityTypeManager()->getDefinition('redirect'); and \Drupal::entityDefinitionUpdateManager()->getEntityType('redirect'). Once you find that difference, we can probably solve it easily :)

    @rraney, I replied to you in 🐛 Every redirect is now disabled after upgrade - enabled toggled off for all redirects Active .

    @yecmom, the Drush command I posted in #3543872-2: Latest version of Redirect module failed to run updates. is an operation that should only be performed once, so it can not be turned into a patch. If you can't run Drush commands on the production server, the next best thing (read: hacky) solution would be to temporary put that code somewhere so it gets executed once. For example write \Drupal::service('update.update_hook_registry')->setInstalledVersion('redirect', 8109); at the top of this method: \Drupal\system\Install\Requirements\SystemRequirements::checkRequirements() (before or after global $install_state;, doesn't really matter), visit the status report page to ensure that it gets executed, then remove that code. After that, you should be able to run the database upgrade properly.

  • 🇺🇸United States rraney

    I'm stuck on not being able to perform entity type update for the 1.12 update. Drupal shows an error matching the one above.

    When I run drush entup using Devel, I get this general error, "SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'enabled' cannot be null". I could provide details of this error. In PHPMyAdmin, the structure for the "enabled" field shows that the default is NULL and the Null field is checked. The values for all records include Default = Null and Enabled = Null.

    The errors in command line reference:
    SqlFieldableEntityTypeListenerTrait.php Line 220
    SqlContentEntityStorage.php Line 866
    ExceptionHandler.php Line 45
    StatementWrapperIterator.php Line 113

Production build 0.71.5 2024