Handle exception in `lookup_ref_lid'