EntityMalformedException: Missing bundle property on entity of type commerce_customer_profile I was doing some work on my custom module which hooks into and modifies Drupal Commerce, and all of a sudden the checkout page wont load and I get this error:

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 173 of /var/www/test.dev/htdocs/includes/entity.inc).
EntityMalformedException: Missing bundle property on entity of type commerce_customer_profile. in entity_extract_ids() (line 7693 of /var/www/test.dev/htdocs/includes/common.inc).

and I have no idea how to fix it! I commented out what I had changed and nothing worked. I even did a git stash on all of my work to revert the changes and still nothing. My only guess is that somehow the database got messed up. How can I fix this? If I have to mess with the database, where do I start?
When you declare an entity and function entity_get_info($entity_type = NULL) is called, the next function cache_set("entity_info:$langcode", $entity_info)  is also called which stores the entity info in the cache table, so probably your change is cached in the database.

If you're  executing drush cc all and you have the same message error again, you can try several more things:


You can call this function entity_info_cache_clear()
https://api.drupal.org/api/drupal/includes!common.inc/function/entity_info_cache_clear/7.
Try executing SELECT cid FROM cache WHERE cid LIKE 'entity_info%' from MySQL command line and then DELETE FROM cache WHERE cid="entity_info:en" -> "en" or whatever depending or your language config.
Try truncating the cache tables:

You can do:

drush sqlc with

SHOW TABLES LIKE 'cache_%';

TRUNCATE cache_tablename;

in order to remove the cached data where entity info is stored. The content of this tables are regenerated programatically when you make a request.


That probably should works