Score:0

InvalidArgumentException: Field field_message_header is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField()

us flag

At a total loss as to what is the cause of this error. The field was added to a Message Notify template entity. It is basically used as a token in emails sent using that module. The only place in my custom code that i use this field is to set its value from a value collected in a modal form. When submitting the modal; this error occurs.

The crazy part of this is that i have removed the field from the entity (so no longer exists in visible config in the site). I have also commented out the 1 line of code that refers to this field. After a db search the only tables to reference this field are config_snapshot and config_import. There were entries there for the field which i removed and the only records which remain are for the bundles which used to hold this field. Can't find any reference to what these tables are for but guessing they are only records of past import and not actively used.

To add to the crazy, this all works fine on my local dev copy of the site.

I have run cron and cr numerous times.

Any hints?

4uk4 avatar
cn flag
You might find hints in the call stack of a full error message. getTranslatedFields() is a protected method which is called by the public get() method, which has as only argument the field name. Which function is on 3rd position of the call stack and where it is getting the argument from?
liquidcms avatar
us flag
Had tried to get call stack to print but wouldn't show for that error (shows in logs for other errors). Anyway, my client restored the db (old) from the production server and we ran cim to get latest config - and this solved the issue. After a year of doing numerous cim on various projects i was comfortable thinking that this was the definitive defn of the site's config - but possibly it isn't. :(
Score:0
us flag

I restored an old db (from the live site) and reran drush cim to get the config which should have been in the staging site (which was showing this error) - and this solved our problem. Very odd that i couldn't find a reference to this field in the db or in code and odd that cim didnt fix it until i ran it on an older db.

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.