throw exception for invalid args