Score:3

Status page shows "Mismatched Entity.." for a Paragraph field but Drush entup give error "..storage cannot change the schema for an existing field"

ng flag

I'm stuck in a loop. The Drupal 9.3 status page shows the following error:

Mismatched entity and/or field definitions
The following changes were detected in the entity type and field definitions.
Paragraph
The paragraph.field_heading field needs to be updated.

When I run drush entup I get the below error. I have a lot of data in the mentioned field so I can't delete the field. How did this mismatch happen and why can't entup resolve it?

4uk4 avatar
cn flag
The messages says you need an update hook migrating the data. Since the module for the entity type Paragraphs provides update hooks for schema changes the problem is probably caused by the field definition. How is the field defined and what changed before the error?
quantumized avatar
ng flag
I'm not sure what you mean by "How is the field defined?" - it's a plain text field used on several Paragraph entities. I've re-saved the fields and Paragraphs everywhere the field is used without any change in the error.
4uk4 avatar
cn flag
You mean the core plain text field type, the field name is shared between different paragraph types and you are trying to re-save the field settings of paragraph types? Then this is the same as in a content type and is not paragraph specific. But why are people using plain text fields all the time without a schema mismatch? There has to be something special in your case, for example did you try to change the text field length?
quantumized avatar
ng flag
Ahhh, I did change the text field length. Wow, I forgot about that. With this new information do you have any suggestions on how to fix the error?
Score:5
cn flag

With this new information do you have any suggestions on how to fix the error?

This schema mismatch in a plain text field doesn't normally happen. You can't change the maximum length in UI, it's not allowed if the field contains data. And you can't import a modified field storage definition, this throws the same error as above and stops the import. So it's unclear how you did this, but the fix is then to use the same way to change it back.


Why can't entup resolve it?

See https://www.drupal.org/project/devel_entity_updates

quantumized avatar
ng flag
Thank you, I found my original documentation and the article with the update hook code to change a field length. I found an issue in the code, fixed reran the update hook and the issue is resolved now.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.