check_uuids_consistent_across_cluster.js (ShardingTest:: checkUUIDsConsistentAcrossCluster) can only be used on JS tests that have shard and config primaries available by the end of the test. Otherwise the aggregation query can fail, as in BF-6748.
This should be clearly documented in check_uuids_consistent_across_cluster.js so it can be better used and so that it will be easier to diagnose the inevitable JS tests we have failed, or will fail, to prevent the check from running upon.