Closed (duplicate)
Project:
Drupal core
Version:
8.6.x-dev
Component:
entity system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Mar 2018 at 08:38 UTC
Updated:
29 Jan 2024 at 21:06 UTC
Jump to comment: Most recent
Comments
Comment #2
cilefen commentedComment #3
mindhunter75 commentedSame here, i have it on every 8.x website.
subscribing!
Comment #4
rubela_shome commentedIn the public function onEntityTypeUpdate() there is
requiresEntityStorageSchemaChanges($entity_type, $original) which checks between changed value and the original value.
if return False the requiresEntityDataMigration($entity_type, $original) returns the 'The SQL storage cannot change the schema for an existing entity type (' . $entity_type
->id() . ') with data.' because there a migration needed without recheck what requiresEntityStorageSchemaChanges() has checked.
On search found this function can return FALSE if any of these conditions apply:
1. There are no existing entities for the entity type.
2. There are existing entities, but the schema changes can be applied without losing their data
(e.g., if the schema changes can be performed by altering tables rather than dropping and recreating them).
3. The only entity data that would be lost are ones that are not valid for the new definition
(e.g., if changing an entity type from revisionable to non-revisionable, then it's okay to drop data for the non-default revision).When this function returns FALSE, site administrators will be unable to perform an automated update, and will instead need to perform a site migration or invoke
some custom update process
Comment #5
BlinX commented@rubela_shome, thank you for diving in to this!
Can you tell what you mean by "perform a site migration", if this is a solution to repair this??
Thanks,
Rolf
Comment #6
rubela_shome commentedBy site migration, I mean to change the version. As you already changed from 8.4.5 to 8.5.1 the suggestion was to revert back/downgrade.
But don't rush to that as it will take you back from where you started. In spite, first of all, you need to pinpoint the cause of the issue.
If I'm not wrong maybe your log files will be able to give you some kind of clue for further investigations and locating the reason.
To locate the involved tables or the issue itself. Might be time consumable but should be helpful. As the function checks that existing data would be lost if the schema changes were applied from the table so if you can find the needed tables
try to update the tables manually, truncate the tables after taking back up of them. Maybe data exists there due to which the function considering
the table can be altered without recreated or deleting.
Also if the entity type is revisionable by deleting the data would cause an issue as revisionable types are valid data and need for a new definition.
Comment #7
g.jordan commentedI am also experiencing this issue with going from 8.4.3 to 8.5.0 then to 8.5.1. I was able to deploy the 8.5.0 iteration but I want this fixed in my 8.5.1 deployment. I am experiencing this error on the field entity type "file", rather than "node".
Comment #8
BlinX commented@rubela_shome, Thanks for your detailled info!
I have to dive deep in this...
Am I right when I say this should be caused by a non core module / theme? Since it seems not many people are having this same problem.
I use Adaptive Theme, are there any other user with same problem using AT?
Comment #9
g.jordan commented@BlinX I am using a custom theme and experiencing this issue.
Comment #10
clafferty commentedI have two almost identical sites (same theme (custom), content types, blocks, modules, etc.). The only difference between them is the actual content entered and one additional field on the content types (just a text field).
One of the sites upgraded to 8.5.1 with no issue, the other is showing this problem. At first I thought it might be because on the problematic site some of the content types had no content... but adding some then upgrading didn't change anything. I suppose it's possible that something in the content is causing the problem... or that I upgraded the modules/core in a different order between the sites and somehow that caused it. Is there a list somewhere that shows all the updates that 8501 would make? I could edit the database manually, but a little reluctant to do that if I might miss something and break things for future updates.
Comment #11
BlinX commentedDo you all also experience that the problem is only there when viewing the website as anonymous user?
When Logged in as Admin or other user it seems to work well!
Comment #12
berdirThe error on it's own is not a problem, that's how it works. The question is who is calling it and that's not visible from those error messages.
Try adding something like debug_print_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) when using drush or enable verbose error logging or set a breakpoint your IDE to see where this is coming from.
What updates are being reported?
Looks like you are using drush 9, so this *might* be coming from a drush entup that it is running? If you check the status page, what kind of entity field mismatches are you seeing there?
Are you using file_entity? which version?
Comment #13
kaurman commentedNot relevant as for fixing the bug but should be of interest to everyone facing this problem nevertheless.
See this advisory. There is a patch one can apply if they are unable to update. Considering the seriousness of the vulnerability the update is supposed to deal with, I would recommend giving the patch a shot.
Comment #14
BlinX commented@Berdir, no I do not use Drush, also not file_entity.
Restored older to version;
Applied the patch @kaurman pointed at, by copying files DrupalKernel.php and RequestSanitizer.php (as stated in the patch) to the existing 8.4.5 install;
Thank you @kaurman !
Enabled verbose error logging;
Made BU;
Updated to Drupal 8.5.1 using Installatron;
Ran Update.php :
Error:
In "Recent Log Messages, besides some other error messages, there is a message of type "Cron":
Also error with type "Menu":
ALso error with type "PHP":
@Berdir, are these the logs you are pointing at?
Can you see anything what might be the solution?
Status Report gives this:
In English this is something like:
Comment #15
BlinX commentedHi all,
My websites seems to be save in version 8.4.7, however upgrading to 8.5.2 still is a problem.
Status report gives (In Dutch):
In English this is something like:
How to do that??
Comment #16
g.jordan commentedHow is this still not fixed?
Comment #17
g.jordan commentedThis is getting old and has now gone into "postponed" status, which is capital-B capital-S. This is breaking lots of sites and yet no one has come up with a solution????
Comment #18
cilefen commentedDear @g.jordan@uky.edu: Comments like your two priors and the one you posted on #2865702-55: Revert schema version when update process failed. are not helpful. I suggest you read https://www.drupal.org/dcoc and think about the thousands of people who have contributed to Drupal over many years so that you can use it, for free. No software is without bugs.
Comment #19
plachWell said, @cilefen.
And to reply to #16 - #17, the reason why this is not fixed yet and that the postponed (needs more info) status is Appropriate (capital A), is that no one has been able to provide instructions to reproduce the issue yet, which makes working on a fix basically impossible.
If you are so eager to see this fixed, one thing that could help would be to upload an anonymized version of your DBs and Drupal source code (data files are not needed), so that they can be run locally and hopefully the issue can be reproduced.
Comment #20
kaurman commentedHad a look at this & tried to update via Drush. The obvious & known part is that it all revolves around revision_default but I have some further questions about the matter.
Here's a fully translated version of what Drush says in response to updb:
I had some custom blocks indeed (Text (formatted, long, with summary), if I'm not mistaken) that contained rather simple html. Removed them (i.e custom blocks library appears to be empty at the moment), cleared the cache and tried again but received the same error message. Why is the system still blabbing about custom blocks?
List of entities, just in case anyone's interested:
Comment #21
plachPossibly related to #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data.
Comment #23
punamshelkeHi,
I am also facing the same issue...
can you suggest me the way to resolve this issue
Comment #24
damondt commentedThis error would be thrown during an update if changes to an entity type definition were being attempted in an update hook and the db columns implied by the entity type definition did not match the actual columns. The described set of circumstances would cause ContentEntityStorageSchema->hasColumnChanges() to return true meaning that the change could not be made with content of that entity type. When I encountered this issue it was due to a module called multiversion that did not clean up after it's self when uninstalled.
Comment #25
MarianT commentedComment #26
MarianT commentedThis has been fixed in 8.7
Comment #27
BlinX commentedMarianT are you sure this is fixed? I tried again and no succes!
Why did you close this issue without mentioning where the duplicate is??
Can someone with more knowledge please look after this?
Comment #28
mrweiner commentedShouldn't close as a duplicate without stating where the duplicate is.
Comment #29
amateescu commented@BlinX, this has been fixed in 8.7.0 with #2984782: Add an API for converting entity type schemas to (non-)revisionable/(non-)translatable, with or without data.
Comment #30
BlinX commented@amateescu, I tried again updating from Drupal 8.4.8 to 8.7.3 but without succes!
I use Installatron to update to new versions.
In Installatron, this message appeared:
Upgrading: Error: 2019-07-07 16:11:44.58008000 FAILURE [3; /usr/bin/curl] https://(domain).nl/update.php/start?id=65&op=do_nojs&op=do&_format=json&continue=1 [http code=500]
What should I do? Can you help me?
Thanks in advance!
Comment #31
damondt commentedI would argue that the referenced issue is not an exact duplicate as the revisionable status of an entity type definition changing is not the only reason that schema changes could be required. That being said, I don't know that a generic solution is possible.
Comment #32
mrunwal commentedI have upgraded Drupal 8.8 to 9.5.2
php 8.1
I am still facing same issue. is there alternate way to fix it either manually by checking db tables to fix it ?
Comment #33
qsurti commentedI have recently installed Drupal 10 on my website, and I am also receiving similar errors as follows;
>>
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Media type
The Media type entity type needs to be installed.
Media
The Media entity type needs to be installed.
>>
Comment #34
mariskath commentedI'm having the same problem. I work on Drupal 10.1.2
On my status report it says:
"Entity/field definitions
Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Media
The Media entity type needs to be installed.
Media type
The Media type entity type needs to be installed."
The media module is part of core and enabled.
When I go to 'uninstall', I get the following errors. Striking is that ' media' is mentioned again, so I think it is related:
The website encountered an unexpected error. Please try again later.
Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table '4tuethics.media' doesn't exist: SELECT "base_table"."vid" AS "vid", "base_table"."mid" AS "mid" FROM "media" "base_table" GROUP BY "base_table"."vid", "base_table"."mid" LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\Query\Sql\Query->result() (line 271 of core\lib\Drupal\Core\Entity\Query\Sql\Query.php).
Drupal\Core\Database\StatementWrapperIterator->execute(Array, Array) (Line: 790)
Drupal\Core\Database\Connection->query('SELECT "base_table"."vid" AS "vid", "base_table"."mid" AS "mid"
FROM
{media} "base_table"
GROUP BY "base_table"."vid", "base_table"."mid"
LIMIT 1 OFFSET 0', Array, Array) (Line: 525)
Drupal\Core\Database\Query\Select->execute() (Line: 271)
Drupal\Core\Entity\Query\Sql\Query->result() (Line: 84)
Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 617)
Drupal\Core\Entity\EntityStorageBase->hasData() (Line: 43)
Drupal\Core\Entity\ContentUninstallValidator->validate('media') (Line: 624)
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array) (Line: 161)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object) (Line: 283)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 583)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 166)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Best regards,
Mariska
Comment #35
mariskath commentedI have run into this problem multiple times now.
The patch in #57 of this thread works for me. https://www.drupal.org/project/drupal/issues/2563515
Best regards,
Mariska