throw an error if element is not present