It is inevitable that some queries will fail and to resolve the problem a mechanism is needed to detect and log those queries.