Locally (WAMP) I have created a new GIT branch to install Drupal Commerce on my site. Everything went well and I have begun configuring my new shop. But when I decided to pull this branch into my remote test site, I get this error:

Catchable fatal error: Argument 2 passed to SelectQuery::fields() must be of the type array, null given, called in /home/httpd/mysite/test.mysite.se/includes/entity.inc on line 317 and defined in /home/httpd/mysite/test.mysite.se/includes/database/select.inc on line 1316

Since I can't reach my admin pages (white screen with error message) and Drush stopped working as well, I used MySQL from the command line to import the database on the remote test site. So now both the codebase and the database should be the same on the remote test site as I have locally. Instead I get the above error. Any ideas? I have a feeling that Rules is involved in this, but that's just a feeling.

I have now done everything from the beginning, with the same result. I have installed all the commerce modules and their dependencies (Entity api, Rules, Address field etcetera) in the suggested order. Everything works fine until I export a database dump and add & commit all changes to my new git branch. After pulling that branch and importing the database dump in my test site (or even locally), I get the message above.

I have managed to run cron, which gave me this message:

User warning: Missing database columns for the exportable entity rules_config as defined by entity_exportable_schema_fields(). Update the according module and run update.php! i _entity_defaults_rebuild() (rad 872 av C:\wamp\www\sites\all\modules\entity\entity.module).

... allthough I am using the latest version of Rules and when I run the database update, the message is that there is no update pending.

I have also seen this warning:

Warning: array_flip() expects parameter 1 to be array, null given i DrupalDefaultEntityController->buildQuery() (rad 308 av C:\wamp\www\includes\entity.inc).

Any hints on what I can do to get my site back on track?

  • try to truncate cache tables from db Dec 22, 2016 at 9:13
  • Thanks, I have now tried that. But with no luck unfortunately.
    – TBJ
    Dec 22, 2016 at 9:31
  • Try clearing cache from /admin/config/development/performance as it can be blocked in drupal cache. Dec 22, 2016 at 9:33
  • I would, but I cannot reach that page, since I only get a white screen with the above error message.
    – TBJ
    Dec 22, 2016 at 9:34
  • if you get these errors in a fresh installation, they're bugs that need to be reported to/discussed in the module issue queue. If not, it must be to do with your configuration/export method, which isn't described, or custom code. I understand it's frustrating when something doesn't work, but to make a useful question for the future, and one that can be answered directly, you'll need to do some debugging, follow the trail of code, and come to some narrower conclusions that can be summarised in the question
    – Clive
    Dec 22, 2016 at 14:45

1 Answer 1


In case anyone else has a similar problem, here is how I solved it. I began by using Drush to disable the commerce modules one after another (in the correct order) to detect which module caused the error. I got so far that in the end I had disabled all the commerce modules, plus Rules and Entity token. And still the same error message was showing (the first one in my question).

I suspected that I really needed to flush all cache, but I could not reach any page in the site, and still it was not enough to truncate all the cache tables in the db and to run Drush cc all. So what to do? I finally found a way to flush all caches with this snippet (https://www.drupal.org/docs/7/administering-drupal-7-site/clearing-or-rebuilding-drupals-cache) in a file named for example clear.php in the web root:

// Define static var.
define('DRUPAL_ROOT', getcwd());
// Include bootstrap.
// Initialize stuff.
// Clear cache.

After saving the above file in the web root, you can just navigate to it whith the browser. In my case I also had to comment out all the memcached rows in settings.php in order for this to work (I got a "Cannot redeclare ..." error message).

When I finally managed to flush all caches this way, the site began to work. I still don't know how I would have done this otherwise. And "Flush all caches" obviously does somehting more than what is accomplished by executing drush cc all + manually truncating all the cache tables in the database.

So if anyone else has a similar problem with white screens and error messages, first try to flush all caches with the method above. And if you use memcached, you will have to comment out everything that regards memchached in settings.php in order to do this.

  • If you are experiencing this, also check to make sure mysql is running, and maybe try restarting mysql. That seemed to be part of the solution in my case.
    – arnoldbird
    Apr 25, 2019 at 16:12

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.