Robust checking for query errors