[1.7.x] Fixed #22922: Better error message for InvalidBasesError.