Really really need help debugging this dpm(). It's an error from trying to create a new Message | Fixed by reinstalling Reply module The Message module was working fine but I noticed one of the messages wasn't getting created by Rules. I suspect it's due to locale being enabled recently and creating with the UI gives this error.

For message types where I haven't created a different language, it seems to work fine.

2 errors in log:

Warning: array_flip(): Can only flip STRING and INTEGER values! in EntityAPIController-&gt;load() (line 219 of /usr/share/nginx/html/sites/all/modules/entity/includes/entity.controller.inc).


.

EntityMalformedException: Missing bundle property on entity of type message. in entity_extract_ids() (line 7930 of /usr/share/nginx/html/includes/common.inc).


The relevant lines in common.inc are:

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


You can see where I added dpm(). $entity is empty but $info gives the below screenshot. 

Any pointers for someone who just isn't used to debugging things like this? I've deleted every message in on the site with VBO but the error persists. 

After two and half years of dev, this site was supposed to go into a proper beta next week in a friend's business but the entire UI relies on the Message module. :/



And here is a dpm of the ids for the flipping error.



Any help appreciated. I didn't expect it to all fall apart this weekend.

Edit: Closed as it is indeed a duplicate. I don't have the skills to deal with it so will just rewrite to use node functionality instead.

Edit 2: Calmed my head today and looked at things that weren't my own code. Turns out it was the Reply module which I use on Message. Reinstalling it gets rid of the errors. I don't know why it happened. It's been a part of Message for like a year during development.
Exception EntityMalformedException is triggered, because (as you mentioned) your $entity is empty, and based on $info['entity keys']['bundle'] Entity module expects to have $entity-&gt;type property, but it doesn't exist.

You should check the backtrace and find which module is responsible for this invalid call, e.g. by adding this line instead of dpm:

var_dump(debug_backtrace()); exit; // Show the backtrace and exit.


in order to identify and fix the broken code. The most relevant part from the backtrace is function which is called, so starting from the top [0]=&gt;, then [1]=&gt;, so once you find the custom code or contrib module responsible for this exception. If there is no custom module apart of messages module, you should report this bug to the maintainer of this module.

Here is the related bug: Fatal errors when content types are deleted before messages are.



For further explanation, check: How to debug EntityMalformedException?