better error explanation for queries