#StackBounty: How do I begin to debug an EntityMetadataWrapperException error on searches?

Bounty: 50

When trying to run a drush cron on a Drupal 7.54 site, I see the following error.

$ drush cron

WD cron: EntityMetadataWrapperException: Invalid data value given. Be
sure it matches the required data type and format. Value at node(): .
in [error] EntityDrupalWrapper->set() (line 756 of
/var/www/html/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).
Cron run successful.

A similar error occurs in WatchDog when we try to search on any term:

$ drush wd-show --tail

641742 15/Feb 15:47 notice search Searched Content for test.
641743 15/Feb 15:47 error php EntityMetadataWrapperException:
Invalid data value given. Be sure it matches the required data type
and format. Value at node(): . in EntityDrupalWrapper->set() (line 756
of /var/www/html/

How do I begin to even understand how to investigate such an error? This seems to be an issue for a few other people too.

Misc:
In this instance of D7.54, we have enabled: Entity Reference (entityreference) 7.x-1.2, Entity API (entity) 7.x-1.8, and – Entity tokens (entity_token) 7.x-1.8. We also running on RHEL 7.2 with PHP 5.4.16.

What I’ve tried so far:
I have commented out this section of code (using a development copy):

<?php
/**
       * Overridden to support setting the entity by either the object or the id.
       */
  public function set($value) {

    if (!$this->validate($value)) {
       /*throw new EntityMetadataWrapperException(t('Invalid data value given. Be sure it matches the required data type and format. Value at !location: !value.', array(
        // An exception's message is output through check_plain().
        '!value' => is_array($value) || is_object($value) ? var_export($value) : $value,
        '!location' => $this->debugIdentifierLocation(),
      )));*/
    }

But this is obviously not a sustainable exercise. It does seem to at least produce the results.

enter image description here

Question:
Short of changing the module code myself — not a great option — what other options could I employ? Is there a way to rescue search page without directly editing this module?


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.