`InvalidArgumentException` seems inappropriate here. `UnexpectedValueException` would be better.