A "Fatal error: Class name must be a valid object or a string […] common.inc" appears on every page on the backoffice.

We don't how to reproduce this because it happens suddenly. When I've done a var_dump() of $class, and $entity_type, this is the result I obtained:

    string 'user' (length=4)
    string 'taxonomy_term' (length=13)
    string 'user' (length=4)

The debug code has been added to entity_get_controller().

function entity_get_controller($entity_type) {
  $controllers = &drupal_static(__FUNCTION__, array());
  if (!isset($controllers[$entity_type])) {
    $type_info = entity_get_info($entity_type);
    $class = $type_info['controller class'];
    echo $class; 
    $controllers[$entity_type] = new $class($entity_type);

  return $controllers[$entity_type];

It seems that $type_info['controller class'] doesn't exist for "User".

This problem is solved when we flush the cache_bootstrap (via DELETE FROM cache_bootstrap) and cache (via DELETE FROM CACHE), but this is a temporary solution because it appears again.

It's a big problem for us. Any idea will be really appreciated.

  • 1
    It would be interesting to see the output of $entities = module_invoke_all('entity_info'); var_export($entities);.
    – apaderno
    Apr 5, 2012 at 19:03
  • 1
    Also, as you are not getting the error when you clean the cache, then something could be wrong with the cached data; maybe they are corrupted.
    – apaderno
    Apr 5, 2012 at 21:14
  • Thank you for your answer. I agree with you about the corrupted cached data. What origin of this behavior ? Thanks of lot !
    – druphus
    Apr 6, 2012 at 14:17
  • I am getting this same error with nowhere to start looking. I cleared the cache and cache bootstrap tables many times to no avail.
    – Kevin
    Jul 2, 2012 at 19:55
  • 1
    Can you show the output of the code I reported in the first comment?
    – apaderno
    Jul 2, 2012 at 22:37

1 Answer 1


The function entity_get_info() is responsible for gathering up this data about your entities. I would try to debug that one, and see what goes wrong.

You will want to have just cleared the cache when you do this, or you debug results will not be correct.

Can't think of a better answer to the question that is still generic enough to be useful for someone else.

  • It was actually errorring out because customentity_load (arg(1)) was being used in a block on the website. I replaced it with entity_load($params)- but this seems like the same path... now that functionality does not work, but the error is gone.
    – Kevin
    Jul 10, 2012 at 1:40

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