"The website encountered an unexpected error." on front page only
Your subquery is returning null, that's why the main query is unable to find entity_id from it. I think you have a wrong query somewhere in your some function, with wrong condition.. Look at this line - WHERE (node.nid = :db_condition_placeholder_0) and actual placeholder - [:db_condition_placeholder_0] =&gt; -1 - entity id can not receive negative value. You can install Devel module, enable query log from devel settings page, log in as authenticated user and see what function calls this query..