Fix ``NameError`` when handling an invalid requirement.