[BZ-986479] avoid trying to retract invalid fact handles