How to fix the Call to a member function selectedQueryColumns() on null error in Statamic 3

Spoiler: It's the cache misbehaving

Published June 13th 2020

If you're unlucky, you might run into this error while developing your Statamic site in version control. The pesky error is Call to a member function selectedQueryColumns() on null.

It's a simple error to fix. Just pop open a console terminal at the root of your project and run php please cache:clear. Refresh and it should be working.

It's a bit annoying while working on the site - especially when you're changing between branches that contain pages and then don't. I'm going to look into seeing if there's a way we can automatically trigger the command when you change a branch, but I'm not holding my breath.