Check for query failure