I've got fatal error EntityMalformedException: Missing bundle property on entity of type node. in entity_extract_ids() (line 7700 of .\includes\common.inc) when trying to access user/xyz.

I tried to retrieve info about the malformed node at line 7700, where the error message is built, thinks like :

if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
 dpm($info);// or dpm($entity);
 throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));

dpm($entity) returns an unexpected user object, and $info a huge qty of things.

Could somebody put me on the right way ?

I already read whatever I could find about Missing bundle property errors, but none helped solving.

dpm($entity) returns

uid (String, 2 characters ) 70
name (String, 9 characters ) John
pass (String, 55 characters ) $S$DUwPuOuDPiDL4nRTYXqc7a5uOfMKey7pyhOFUEKka1XM...
mail (String, 30 characters ) [email protected]
theme (String, 0 characters )
signature (String, 0 characters )
signature_format (String, 13 characters ) filtered_html
created (String, 10 characters ) 1396286331
access (String, 10 characters ) 1397146661
login (String, 10 characters ) 1396513460
status (String, 1 characters ) 1
timezone (NULL)
language (String, 2 characters ) fr
picture (NULL)
init (String, 30 characters ) [email protected]
data (Array, 5 elements)
roles (Array, 1 element)
og_user_node (Array, 0 elements)
message_subscribe_email (Array, 1 element)
field_bio (Array, 0 elements)
field_name_first (Array, 1 element)
field_name_last (Array, 1 element)
field_facebook_url (Array, 0 elements)
field_linkedin_url (Array, 0 elements)
field_twitter_url (Array, 0 elements)
user_trusted_contacts (Array, 1 element)
group_group (Array, 1 element)
group_access (Array, 1 element)
metatags (Array, 0 elements)
rdf_mapping (Array, 3 elements)
realname (String, 13 characters ) John Doe
content (Array, 13 elements)
entity_view_prepared (Boolean) TRUE
privatemsg_disabled (Boolean) FALSE
  • This is usually a pretty low level one that you can find out just by dpm()'ing the $entity. Make sure you are passing the entity itself -- and not a set of entities that entity load functions return.
    – AKS
    Commented Apr 29, 2014 at 17:20
  • 1
    I meant the it is basically checking if the bundle information exist before throwing the exception. If you could post the output of dpm($entity) (with the sensitive information blurred of course), that will help others to see what's wrong.
    – AKS
    Commented Apr 29, 2014 at 17:26
  • 3
    @Kojo The cause is actually a really simple one...something is calling entity_extract_ids('node', $var);, but instead of a node object for $var, it's passing a user object. If you have any custom or dev version contrib modules, try disabling them one by one to see it you can find the culprit
    – Clive
    Commented Apr 29, 2014 at 17:34
  • 2
    Yikes. dpm(debug_print_backtrace()); will be invaluable here. You can see what module started it all off by following the functions back to the beginning of the request
    – Clive
    Commented Apr 29, 2014 at 17:40
  • 1
    No worries, if you can get xdebug installed and configured with xdebug.collect_params = 4 that will also make your life a lot easier
    – Clive
    Commented Apr 29, 2014 at 17:47

3 Answers 3


The error:

EntityMalformedException: Missing bundle property on entity of type node.

happens, because your bundle property is malformed either on load or save, so Drupal can't find what type of bundle is it.

The logic of that Exception is:

// Explicitly fail for malformed entities missing the bundle property.
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
  // var_dump(debug_backtrace()); exit; // You may want this line to debug.
  throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));

So basically value of $info['entity keys']['bundle'] (for node it's: type) can't be found in $entity object ($node->type for the node), therefore Drupal doesn't know with what kind of entity it's dealing with. So most likely your entity is invalid (e.g. you're loading something else instead) or it is just empty ($entity is NULL).

If you haven't modified any Drupal code, this potentially can be caused by variety of things (most likely by specific Drupal module bug), such as:

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']};


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.

Note: Using dd() function from Devel will generate the debugging info to the file in your Drupal temp folder (temporary://drupal_debug.txt) with backtrace dump, otherwise could be too big and difficult to read when dumping on the screen. When using var_dump(), it's easier to call die(); after the call and check the dump in the view-source mode of the page.

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.

  • 3
    kudos for a such detailed answer! I solved my issue a long time ago, but not doubt this will be helpful for a lot of people, me included.
    – Kojo
    Commented Sep 8, 2015 at 11:37
  • 3
    This is a fantastic answer! Deserves more upvotes.
    – Christian
    Commented Apr 6, 2016 at 6:26
  • I added dd(debug_backtrace()); to the affected line in front of throw new EntityMalformedException, made sure Devel is enabled and ran the drush command in cron that is throwing this error and am not getting any debugging output. What did I do wrong? Thanks!
    – Christia
    Commented Feb 24, 2017 at 22:37
  • 1
    Found it: the command created a file called drupal_debug.txt inside /tmp/drupal_theme/ where "drupal_theme" is the name of the drupal theme. Thanks for your excellent debugging help!
    – Christia
    Commented Feb 24, 2017 at 22:54

Thanks to Clive comments, I solved the issue as following.

Added ddebug_backtrace() where error occured (entity_extract_ids(), line 7700 of .\includes\common.inc ) to print the function call stack.

Then looking for anything unexpected in output, I found that a pane visibility rule might be the problem.

19: ctools_entity_field_value_ctools_access_check() (Array, 2 elements)
  file (String, 81 characters ) profiles\commons\modules\contrib\ctools\plugins...
  $...['19: ctools_entity_field_value_ctools_access_check()']['file']
  args (Array, 3 elements)
    0 (Array, 2 elements)
      field_theme (Array, 1 element)

I had applied a patch on entity_field_value.inc a few days ago just to solve a visibility rule notice... and created a test visibility rule with a field_theme condition.

Now reverting patch or removing any pane visibility rule solved current EntityMalformedException bug... Powerful ddebug_backtrace() !

  • I tried this method and i got 1000's of line of code on front end. How do you see where the error is?
    – Sam
    Commented Jul 3, 2015 at 17:08
  • @Sam have a look at Kenorb answer, it might help you
    – Kojo
    Commented Sep 8, 2015 at 14:47

This issue comes up when there are orphaned nodes, simply get rid of them and cron will run without any error. Search indexing will finally get to 100%. Backup your database before proceeding.

Assuming you have access to phpMyAdmin, run this SQL code to identify the nodes then delete them. Replace my question content type machine name with your specific content type machine name one after the other till you get no result, that's after deleting.

SELECT n.nid, n.title, n.vid, nr.vid FROM drcm_node n LEFT JOIN drcm_node_revision nr ON nr.nid = n.nid WHERE n.type = 'question' AND nr.vid IS NULL ORDER BY n.nid ASC

You can delete the orphaned nodes by using the SQL code below. Replace the numbers in the bracket with your specific node IDs

DELETE from node where nid IN (12779,12780,12781,12782)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.