This should probably be ValueError to be consistent with the other message.