Skip to main content
2 of 8
Fixed typo.
kenorb
  • 14.3k
  • 10
  • 98
  • 168

The error:

EntityMalformedException: Missing bundle property on entity of type node.

happens, because your bundle property is malformed either on load or save, and it basically can't identify what type (bundle) is it.

This could be potentially caused by variety of things such us:

Here is the responsible code which is thrown by Drupal core (file: common.inc):

 if (!empty($info['entity keys']['bundle'])) {
    // Explicitly fail for malformed entities missing the bundle property.
    if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
      throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
    }
    $bundle = $entity->{$info['entity keys']['bundle']};
  }

Debugging

If you don't recognise anything above, the easiest thing to debug that kind of error is by placing var_dump(debug_backtrace()); or dd(debug_backtrace()); (when Devel is on) before the actual throw new EntityMalformedException on the affected line in common.inc.

If this is happening on node save, check this EntityMalformedException post at SO for more detailed instructions.


See also the following Drupal issue: #1778572 for more ideas.

kenorb
  • 14.3k
  • 10
  • 98
  • 168