Fix error handling for invalid mws queries.